Verse 1 – Hear me when I call, O God, of my righteousness! You have relieved me when I was in distress; have mercy on me, and hear my prayer.
David knew, even then, his righteousness was from God, just as our is today through Jesus Christ. David was telling God that he also knew God would vindicate him.
Verse 2 – How long, O you sons of men, will you turn my glory to shame? How long will you love worthlessness and falsehood? Selah
David may have written this during the time of Absalom was trying to convince others that David was not worthy of being their king.
Verse 3 – But know that the Lord has set apart for Himself him who is godly: The Lord will hear when I call to Him.
Matthew 22:14-“For many are called, but few are chosen.” David was anointed and called to be the king over all of Israel. It was his choice to follow God. Because David had a heart to follow God, God had set him apart from others. David knew therefore God would hear him when he called to Him. Being Godly is being devoted to God and His ways.
Verse 4 – Be angry, and do not sin. Meditate within your heart on your bed, and be still. Selah
David wanted his enemies to turn from following their anger and to start trusting God.
Verse 5 – Offer sacrifices of righteousness, and put your trust in God.
David had said earlier that God was his righteousness, so he knew he had the assurance that God had heard him and would answer him. David, I’m sure, had gotten angry when Absalom, his son, had run him out of the palace and turned the people against him. However, even though David was deeply hurt, he knew to trust God in this matter and go to sleep in peace.
Verse 6 – There are many who say, “Who will show us any good?” Lord lift up Your countenance upon us.
Verse 7 – You have put gladness in my heart, more than in the season when their grain and wine increased.
David chose to praise God in spite of his circumstances. The inner gladness was a joy that came from trusting God. We sometimes get joy and happiness confused. Happiness can only last as long as the circumstances are good.
Verse 8 – I will both lie down in peace, and sleep; for You alone, O Lord make me dwell in safety.