This psalm is a close copy of the song of David found in 2 Samuel 22. It’s clear from both 2 Samuel and from the title of the psalm that David wrote it near the end of his life. He had defeated his enemies, consolidated his kingdom after the long and bitter struggle with Saul, had extended the land under Israel’s domination to the boundaries God had promised, from the River Euphrates to the River of Egypt, and had defended it against usurping sons.
David’s life had been a life of war, and this psalm reflects that fact. He praises God for all the victories he had won against his own and Israel’s enemies, starting with Goliath and the Philistines and continuing on through Saul, Doeg, Cush, the Ziphites, Nabal, Achish, Absalom, Shimei, Ahithophel, Adonijah, Moab, Ammon, Edom and others. He takes no credit for himself. Throughout the psalm he says, over and over again, the Lord did it. The Lord answered my prayers. The Lord rescued me from my enemies. The Lord equipped me for war. The Lord made me king and secured my kingdom for me. It is not I, I, I, but always the Lord. He deserves all the praise.
The psalm has two main parts. Verses 1-27 celebrate the Lord’s defense of him against attacking enemies throughout the whole of his life. Verses 28-50 celebrate the conquests achieved by the Lord’s help as David expanded the territory of Israel to the boundaries God had promised.
Each part has subsections.
Part 1: Victory in Defensive War
1-3: Love for the Lord because he defends
4-6: Prayer to the Lord in trouble
7-19: The Lord answers his prayer
20-27: Explanation for the answer in David’s righteousness
Part 2: Victory in Offensive War
28-36: The Lord equips him for war
37-45: The Lord gives victory over enemies
46-50: The Lord’s help throughout his life
The A parts make the claim that the Lord has recompensed him according to his righteousness. The B parts say that the Lord has done this because he kept the ways of the Lord and kept himself from iniquity. The central verse explains how it was that he kept the ways of the Lord; his judgments were before me. Only the Lord Jesus Christ can make such claims for himself. David can say it only as he is in Christ.
Verses 20-24 form a chiasm.
A 20. Yahweh recompensed me according to my righteousness;
according to the cleanness of my hands he rewarded me.
B 21. For I have kept the ways of Yahweh,
and have not wickedly departed from my God.
C 22. For all his judgments were before me,
and his statutes I did not cause to depart from me.
B’ 23. And I was perfect with him,
and I kept myself from my iniquity.
A’ 24. And Yahweh rewarded me according to my
righteousness,
according to the cleanness of my hands before his eyes.
The A parts make the claim that the Lord has recompensed him according to his righteousness. The B parts say that the Lord has done this because he kept the ways of the Lord and kept himself from iniquity. The central verse explains how it was that he kept the ways of the Lord; his judgments were before me. Only the Lord Jesus Christ can make such claims for himself. David can say it only as he is in Christ.
As Christians we are sometimes on the defensive in our spiritual warfare. The enemy attacks by means of persecution or powerful appeals to our flesh, and we cry to the Lord for his help against them. He is always ready to hear and answer. At other times we are on the offensive. We go out proclaiming the word of God, wielding the sword of the Spirit, and the Lord uses his word to bring many to their knees before the King of Kings, and to destroy all those who will not believe and obey.
Ultimately, the psalm is a celebration of the victories of our Lord Jesus Christ who goes forth conquering and to conquer until all his enemies have become his footstool (Cf. Psalm 110) and until all his people have received all the salvation he won for them on the cross. He is the one who saves us from oppression, temptation and death, and gives to us victory over the Devil, the world and our own flesh.
To this great salvation we respond with grateful praise: “I will love you, O LORD, my strength.”