A Worshiper's Prayer
It appears that David is protesting accusations against his integrity, from his enemies who he calls idolatrous, wicked, evildoers, and hypocrites. He claims to have walked in the truth, to have avoided any contact with renegade Jews, and to have participated regularly in worship. All of this stands in sharp contrast to the conduct of his enemies.
Much as Job did, David presents the case for his integrity. He is sure that God will be merciful and redeem and him because of his “lovingkindness.” He then prays that God not leave him is the company of the ungodly. He prays for redemption and mercy because he has maintained his integrity. Because he is confident of God's mercy he will publicly praise Him.
Psalm 26 reveals the quality of the state of mind that should characterize every child of God. It reflects the humble, yet confident, peace of the believer.
Philippians 4:7 (NKJV)7 and the peace of God, which surpasses all understanding, will guard your hearts and minds through Christ Jesus.
Philippians 2:5-7 (NKJV)5 Let this mind be in you which was also in Christ Jesus,
6 who, being in the form of God, did not consider it robbery to be equal with God,7 but made Himself of no reputation, taking the form of a bondservant, and coming in the likeness of men.
This mindset despises evil and embraces godliness.