Imagine that one of the palace officials sees the prophet Nathan off in his chariot after his closed-door visit with David (2 Samuel 11). He returns to the court and asks the king, “Are things well in the kingdom, your majesty?”

“Well, let’s see,” David begins, “Nathan just rained all over my lack of marital faithfulness and said my wives would be given to someone close to me. He told me Bathsheba and I would lose our baby boy, and he exposed my involvement in the death of her husband, Uriah. Because I brought the sword down on him, the sword will not depart from my family. So no, I wouldn’t say things are ‘well’ in the kingdom.”
Some of the worst pain for David came from knowing that there was no one to blame but himself (there’s no pain quite like that). He had complete agency over his thoughts and actions. His own sins had put him where he was. If only Nathan had told him on the rooftop where acting on his lust would lead—he never would have called Bathsheba to him. But that’s not the way life works, is it? God wants us to make choices of our own free will, hoping we allow our will to be shaped by His. When we do that, we’re blessed and when we don’t . . . Well, that’s one of the reasons why we have this story.

But David hadn’t just brought pain upon himself; like ripples of water his actions had brought and would bring great pain to others: Uriah, Bathsheba, his newborn son, and others in his family for starters. But most of all, he had brought pain to God his Father. His behavior had shown “contempt” (NIV) and “scorn” (ESV) for Him. They didn’t represent David in his better moments—but there it was right out there with everything else.
And finally, maybe the biggest question: how could he move forward? It wasn’t an issue of forgiveness—God had graciously forgiven him and spared his life (12:13). And if God had forgiven him, he could forgive himself. He was very grateful for that. But how did he move into the future knowing the pain and difficulties it would bring? I believe Psalm 51 provides some help to this question.
The uninspired superscription suggests that the psalm was written by David sometime after Nathan’s visit to him. It may or may not have been (James May), but for our purposes, it doesn’t matter—it fits David’s circumstances and the writer speaks as a person after God’s heart, as David was (Acts 13:33).
After confessing his sin and asking God’s forgiveness in v. 1-9, the writer moves on to our question of how to move forward. He asks God for a pure heart and a steadfast spirit (v. 10). “Pure” doesn’t mean without any trace of sin or blemish (that won’t happen until we’re home with Him). The concept is instead one of singlemindedness—he Is praying for a heart where God, not himself, reigns. He isn’t interested in repentance that lasts for a moment or two—he wants it to be an ongoing part of his life, so he prays for “a steadfast spirit.” This is not something new to him, he had possessed such a spirit before, but it needed to be renewed so he would be sustained (v. 12b).
Then he turns to God’s presence in his life through the Holy Spirit (v. 11). He understands he needs the presence of God in his life if he is to live for God. He cannot do it on His own and he has no wish to try.
He concludes with a request that God would “restore to me the joy of Your salvation” (v. 12). This is the prodigal feasting with his father (Luke 15). You remember the prodigal’s hope was simply to be accepted enough to come back as a servant—but his father would not hear of it. Neither will ours.
This is important. We are being told that there is a joy that transcends our greatest guilt and shame. Knowing this, we can possess joy even in the midst of suffering (Romans 5:1-5). We can not only move forward, we can move forward with joy. This is exactly what Jesus did (see John 15:9-11).
Singlemindedness, a steadfast spirit, God’s presence, and the joy of salvation. I suppose it’s a tempting (for some) to make a formula out of this for moving forward after you’ve fallen and been forgiven (The Four Steps for Moving Forward). The NT knows nothing of cute little formulas for spiritual prosperity. On the other hand, it does know something of principles of love that help us live a cross shaped life.
That’s where we’ll find Jesus.