Psalm 17 describes in metaphorical flourishes the psalmist’s enemies. 

But before David, or whoever the psalmist was, describes them, he calls on God to act. Then he describes the nastiness of his enemies; then he pleads with God to be nasty toward the enemies. Plea, enemies, plea — that’s his order. I’m inclined to want the sort of vindictive desires we see in this Psalm to be the genuine emotional expression of the psalmist, which it is. I’m further inclined to think that the Psalms don’t endorse this sort of vengeance but they do teach us that this is what real prayer looks like. But I’m constantly aware that such a way of evading the obvious — the violence, the vengeance — is a way of evasion. I wonder, in fact, if this prayer doesn’t express the heart of someone devoted to justice and that genuine justice pleading at times knows it must plead for God to act to vindicate someone.
He calls because God acts (v. 6); he pleads with God to extend his ear and to listen (v. 6). He pleads with God to act because it shows God’s faithfulness (v. 7). He pleads with God to put him in a safe location; he wants to find a place of refuge (v. 8). 
Now David begins to describe his enemies (vv. 9ff). They are faithless and they have assaulted him; they are enemies surrounding him with longing (v. 9). They are calloused and speak arrogantly (v. 10). They attack and surround and make plans to do him in (v. 11). In fact, though he now moves to a singular instead of the plural, the enemy is like a lion – eager to tear and to pounce on its prey (v. 12).
David then returns to God as the rescuer/savior, and pleads yet again for God to act (vv. 13-14). His desires are vindictive and violent. The plea is almost chilling.
Then David turns to God: he wants God’s face to be the face he sees and not the face of his enemies.

A prayer of David.

17:1 Lord, consider my just cause!

Pay attention to my cry for help!

Listen to the prayer

I sincerely offer!

17:2 Make a just decision on my behalf!

Decide what is right!

17:3 You have scrutinized my inner motives;

you have examined me during the night.

You have carefully evaluated me, but you find no sin.

I am determined I will say nothing sinful.

17:4 As for the actions of people –

just as you have commanded,

I have not followed in the footsteps of violent men.

17:5 I carefully obey your commands;

I do not deviate from them.

17:6 I call to you for you will answer me, O God.

Listen to me!

Hear what I say!

17:7 Accomplish awesome, faithful deeds,

you who powerfully deliver those who look to you for protection from their enemies.

17:8 Protect me as you would protect the pupil of your eye!

Hide me in the shadow of your wings!

17:9 Protect me from the wicked men who attack me,

my enemies who crowd around me for the kill.

17:10 They are calloused;

they speak arrogantly.

17:11 They attack me, now they surround me;

they intend to throw me to the ground.

17:12 He is like a lion that wants to tear its prey to bits,

like a young lion crouching in hidden places.

17:13 Rise up, Lord!

Confront him! Knock him down!

Use your sword to rescue me from the wicked man!

17:14 Lord, use your power to deliver me from these murderers,

from the murderers of this world!

They enjoy prosperity;

you overwhelm them with the riches they desire.

They have many children,

and leave their wealth to their offspring.

17:15 As for me, because I am innocent I will see your face;

when I awake you will reveal yourself to me.

More from Beliefnet and our partners