We have here the first of four psalms of David crying out to God in times of distress. This one refers to the political and military plots against him as God’s anointed. Keep in mind that, regardless of the actual meaning of selah, its purpose is to provoke a moment of contemplation to allow the image to take shape in the mind.
There are four stanzas of varying types of threat. First is the image of bitter opposition, someone with a burning resentment. This is not someone with a wise plot to oust David from power so much as the kind of person who seeks any opportunity for spite.
Second is the picture of traitors, people who draw close to him only so they can pick out some weakness to exploit. While physical harm from this angle is less likely, it’s still a form of violence.
Third is any number of people who are morally wicked. This is like a plague against which David prays quite often. David uses the image of God providing a head covering against a strike that would confuse him and render him powerless in battle. He pleads with God to ensure this kind of people don’t succeed lest they hinder God’s glory in seeking their own.
Fourth is what would easily be David’s most serious problem of all: Those who seek to hem David in, to corner him and humiliate him. We should all recognize the utter frustration of facing bullies. Thus, David’s imprecation is quite severe on these, begging that God not let them escape their just punishment.
In the final two verses, David celebrates his confidence in Jehovah as the ultimate source of justice for the oppressed and afflicted. This frees the righteous to stand and praise the Lord.