I was taught you can lose your salvation. Is that true? If not, then why does David ask the Lord in the Psalms to “Cast me not from thy presence oh Lord, take not thy Holy Spirit from me.” He makes it sound as if it is possible for the Holy Spirit to be removed.
The clear, unmistakable and continual teaching of scripture from Genesis to Revelation is this: it is impossible for a saint to ever return to the unregenerate state he existed in prior to faith. In other words, it is impossible to lose your salvation. Once you believe, you become an adopted child of God, never to be sent away again (Eph 1:5; Gal 4:5). You were sealed forever by the Holy Spirit (Eph 4:30).
You were not saved by your actions nor thoughts, but by His will and grace (Eph 2:8). Therefore, if you did nothing to obtain your salvation, you can do nothing to lose it. It was never under your control. It is a gift.
Secondly, you cannot lose your salvation nor even "turn it in" because of what God did in your heart and spirit at the moment of salvation. He performed a permanent work in your spirit by putting the old spirit to death and bringing you a new spirit, so that you are now a new creature (2Cor 5:17). The old self is gone forever never to return. You can no more return to your old state than a butterfly can return to the cocoon and become a caterpillar again. It's not a matter of our will or desire or even our obedience. To return is simply spiritually impossible. Praise the Lord!
Regarding David's comment in Psalm 51, this is a significant psalm for several reasons. I've included a copy of the Psalm below in a modern English translation:
51:1 Be gracious to me, O God, according to Your lovingkindness; according to the greatness of Your compassion blot out my transgressions.
51:2 Wash me thoroughly from my iniquity And cleanse me from my sin.
51:3 For I know my transgressions, And my sin is ever before me.
51:4 Against You, You only, I have sinned And done what is evil in Your sight,
So that You are justified when You speak And blameless when You judge.
51:5 Behold, I was brought forth in iniquity, And in sin my mother conceived me.
51:6 Behold, You desire truth in the innermost being, And in the hidden part You will make me know wisdom.
51:7 Purify me with hyssop, and I shall be clean; Wash me, and I shall be whiter than snow.
51:8 Make me to hear joy and gladness, Let the bones which You have broken rejoice.
51:9 Hide Your face from my sins And blot out all my iniquities.
51:10 Create in me a clean heart, O God, And renew a steadfast spirit within me.
51:11 Do not cast me away from Your presence And do not take Your Holy Spirit from me.
51:12 Restore to me the joy of Your salvation And sustain me with a willing spirit.
51:13 Then I will teach transgressors Your ways, And sinners will be converted to You.
51:14 Deliver me from bloodguiltiness, O God, the God of my salvation; Then my tongue will joyfully sing of Your righteousness.
51:15 O Lord, open my lips, That my mouth may declare Your praise.
51:16 For You do not delight in sacrifice, otherwise I would give it; You are not pleased with burnt offering.
51:17 The sacrifices of God are a broken spirit; A broken and a contrite heart, O God, You will not despise.
51:18 By Your favor do good to Zion; Build the walls of Jerusalem.
51:19 Then You will delight in righteous sacrifices, In burnt offering and whole burnt offering;
Then young bulls will be offered on Your altar.
This psalm describes the nature of the salvation process. The psalm begins with David acknowledging his sin before God (vs. 1-5). These verses describe the repentance step of salvation, including the fact that all men are born sinful (v. 5).
Then David moves next to describing spiritual regeneration (vs. 6-10), the time when God changes our hearts and brings us the gift of faith (see also Eph 2:8-9). This is the part of the salvation process where our old nature (i.e., our old spirit) is put to death and we are made a new creature in Christ (v. 10).
Pay close attention to the language of verse 6 in particular, where David describes how God plants wisdom (i.e., brings the knowledge of salvation through the Lord) in a "hidden" part of himself. His sins were blotted out (v. 9), which means they simply don't exist anymore. There is no condemnation possible for a Christian, because the entire penalty for our sins has already been paid by Christ. God can't punish us for sin, because that punishment has already been given to Christ.
Then in vs. 11-15 David expresses the hope of his salvation. David is not wondering if God will do these things; rather, he is acknowledging that these things will be the consequence of God granting him salvation. Look at the full list:
v.11 - the believer is never to be cast away
v.12 - the believer has joy in his salvation and is sustained by God's will
v.13 - the believer then teaches others and converts unbelievers
v.14 - the believer is free from the guilt of sin and praises God's righteousness
v.15 - the believer praises God
These are the consequences for a believer who has obtained salvation. As a new creature in Christ, we have these new behaviors to accompany our new nature. (Please see 1John 2 for a good teaching on this principle.)
Given all David wrote, the only way to interpret v. 11 to mean that a believer can lose salvation is to read that point of view into the text, since the author himself didn't have that thought on his mind when he wrote those verses. In fact, the author's point was completely the opposite - David was declaring the good things that come with salvation.