Have mercy on me, O God,
according to your unfailing love;
according to your great compassion
blot out my transgressions.
Wash away all my iniquity
and cleanse me from my sin.
For I know my transgressions,
and my sin is always before me.
Against you, you only, have I sinned
and done what is evil in your sight;
so you are right in your verdict
and justified when you judge.
Surely I was sinful at birth,
sinful from the time my mother conceived me.
Yet you desired faithfulness even in the womb;
you taught me wisdom in that secret place.
Cleanse me with hyssop, and I will be clean;
wash me, and I will be whiter than snow.
Let me hear joy and gladness;
let the bones you have crushed rejoice.
Hide your face from my sins
and blot out all my iniquity.
Create in me a pure heart, O God,
and renew a steadfast spirit within me.
Do not cast me from your presence
or take your Holy Spirit from me.
Restore to me the joy of your salvation
and grant me a willing spirit, to sustain me.
Then I will teach transgressors your ways,
so that sinners will turn back to you.
Deliver me from the guilt of bloodshed, O God,
you who are God my Savior,
and my tongue will sing of your righteousness.
Open my lips, Lord,
and my mouth will declare your praise.
You do not delight in sacrifice, or I would bring it;
you do not take pleasure in burnt offerings.
My sacrifice, O God, is a broken spirit;
a broken and contrite heart
you, God, will not despise.
May it please you to prosper Zion,
to build up the walls of Jerusalem.
Then you will delight in the sacrifices of the righteous,
in burnt offerings offered whole;
then bulls will be offered on your altar.
Psalm 51 is one of the most well-known Psalms of confession and repentance in the entire book of Psalms. David wrote it after he had committed adultery with Bathsheba and arranged for the murder of her husband, Uriah. In this Psalm, David pleads with God for forgiveness and restoration, recognizing the weight of his sin and his need for God's mercy.
We also see David's fear of losing the Holy Spirit. He recognizes that his sin has not only caused harm to others but has also grieved the Spirit of God. He pleads with God not to cast him away from his presence or take the Holy Spirit from him. David understands that the Holy Spirit is the source of his strength, wisdom, and righteousness. Without the Holy Spirit, he would be as powerless and lost as his predecessor Saul was when God took his Spirit away from him.
As believers, we need not fear having the Holy Spirit taken away from us. The Bible teaches that the Holy Spirit is given to believers as a seal of their salvation and as a guarantee of their inheritance in Christ (Ephesians 1:13-14). The Holy Spirit is also referred to as the Spirit of adoption, testifying with our spirit that we are children of God (Romans 8:15-16). Therefore, we do not have to fear losing the Holy Spirit, as the presence of the Holy Spirit in our lives is a sign of our salvation and a promise of our eternal inheritance.
However, we must note that we can grieve the Holy Spirit through sin (Ephesians 4:30) and quench the Holy Spirit by resisting his work in their lives (1 Thessalonians 5:19). If we persist in unrepentant sin or refuse to follow the leading of the Holy Spirit, our spiritual growth and relationship with God may be hindered. In such cases, we must confess and repent of sin and yield to the Holy Spirit's work in our lives. But as long as we remain in Christ, we can have confidence that the Holy Spirit will continue to work in and through us (Philippians 1:6).
God bless you.