It is well known that King David fell into horrible sin, committing adultery and covering it up with murder. Moreover, we know David was full of the Holy Spirit, so he must have been miserable.
The prophet Nathan confronted him, saying, "You have brought reproach on God's name." David could only go for so long carrying the weight of the horrible acts he had perpetrated and he immediately confessed and repented. Even as he was still weeping Nathan assured him, "The Lord also has put away your sin; you shall not die” (2 Samuel 12:13).
Yet, hearing that assurance wasn't enough for David. You see, it is one thing to be forgiven and quite another to be free and clear with the Lord. David knew that forgiveness was the easy part. Now he wanted to get things right with God, to be able to get his joy back. So he cried, "Do not cast me away from Your presence, and do not take Your Holy Spirit from me" (Psalm 51:11).
Psalm 51 was written as David remembered the merciful, longsuffering nature of the Lord. In the opening verse he appeals to God's tender forgiveness: "Have mercy upon me, O God, according to Your lovingkindness; according to the multitude of Your tender mercies, blot out my transgressions."
David knew just what to do. He cried out! "This poor man cried out, and the Lord heard him, and saved him out of all his troubles" (34:6).
"The eyes of the Lord are on the righteous, and His ears are open to their cry. . . The righteous cry out, and the Lord hears, and delivers them out of all their troubles" (Psalm 34:15 and 17).
Dear saint, your victory over every battle is learning to possess this confidence: No matter how grievously you have fallen, you serve a Lord who is ready to forgive. Indeed, he is anxious to heal you. He possesses more lovingkindness toward you than you could ever need.