Psalm 18—the third longest in the Psalter—is a psalm of David, written, according to the inscription, “on the day when the LORD rescued him from all his enemies, and from the hand of Saul.” The psalm is recorded almost verbatim in 2 Samuel 22. David spent much of his early reign engaged in battle, so much so that God would not allow him to build the temple because he was “a man of war” who had “shed blood” (1 Chronicles 28:1–3). But when God finally subdued his enemies and gave him a measure of political peace, he penned this psalm as an act of praise.

It is incredible to note, however, David’s words in the middle part of the psalm. Rejoicing in the fact that God had given him deliverance, he claims,

The LORD dealt with me according to my righteousness; according to the cleanness of my hands he rewarded me. For I have kept the ways of the LORD, and have not wickedly departed from my God. For all his rules were before me, and his statutes I did not put away from me. I was blameless before him, and I kept myself from my guilt. So the LORD has rewarded me according to my righteousness, according to the cleanness of my hands in his sight.

(Psalm 18:20–24)

These words have led some interpreters to doubt that David wrote the psalm, despite the superscription. After all, could David—the same David who used his power to sexually violate Bathsheba and cover it up by ordering the murder of her husband—really make this claim? How “merciful” and “blameless” was David in his interactions with Uriah and Bathsheba? Surely the man who committed those deeds could not honestly claim righteousness and cleanness in God’s sight?

Honestly speaking, how do you feel when you read these words? Perhaps you have tried praying the words of this psalm. How did it go when you reached this section? Could you confidently pray that God had dealt well with you, and delivered you from your trials, in response to your righteousness and the cleanness of your hands?

I’d like to think that nobody reading this has been guilty of the sins that David committed. I hope that you have not used whatever power God has given you to abuse those who are under your care. I hope that you have not resorted to murder in order to cover up your sins. I don’t know for sure, but I’d like to think that we are not guilty of those sins.

Still, if you are like me, you are probably not rushing to pray confidently that God has dealt kindly with you in response to your righteousness and your clean hands. So how could David pray with such boldness?

Happily, we don’t have to be very imaginative in answering the question. We don’t even have to look very far, because he gives us the answer in the very same prayer: “For who is God, but the LORD? And who is a rock, except our God?—the God who equipped me with strength and made my way blameless” (vv. 31–32).

Did you catch that? How could David claim blamelessness? Because Yahweh his God had “made [his] way blameless.”

We all know what it is like to face temptations to sin at school, at work, and on the road. We know what it is to lay our head down tonight and lament the ways in which we have failed God. As you do so, remember that, in Christ, you can claim righteousness and clean hands because the Lord your God, at Calvary, purchased your eternal salvation and made you—and continues to make you—blameless in his sight. Remember—and rejoice in—the truth of the gospel.