David was a failure, but the reason David's failures did not cripple him and maim him and render him useless is because he channeled the power of the gospel through repentance. Psalm 51 is the record of David's confession after his sin with Bathsheba and the murder of Uriah the Hittite. The prayer is a source of great encouragement to us because whatever our failures may be, they can be washed as white as snow. The core of David's prayer is a plea for God to affect change. The prayer is a beggarly prayer of asking God to do what he can not do on his own. This is how we must come to God in repentance as well. Wash me and cleanse me (verse 2)! Cleanse me with hyssop (verse 7). It is a prayer for the divine to remove the dirt and sin and shame.
We know, this side of the cross, that the cleaning we need is not just a surface cleaning but a heart transformation.
God put his righteousness in us through the death of his Son, Jesus Christ. That kind of supernatural work is what we need for both salvation and sanctification. David was unashamed of his helplessness. Can you go to God in this way? Will you pray like David, "Create in me a clean heart oh God!"