Romans 7:15-18 English Standard Version
15 For I do not understand my own actions. For I do not do what I want, but I do the very thing I hate. 16 Now if I do what I do not want, I agree with the law, that it is good. 17 So now it is no longer I who do it, but sin that dwells within me. 18 For I know that nothing good dwells in me, that is, in my flesh. For I have the desire to do what is right, but not the ability to carry it out.
Once we make Jesus Christ the Lord of our lives the desire to do right is the will that abides in our hearts. Christ who reigns from within our hearts. Our will is selfless, it hears and believes our Lord. Obedience on the other hand is a function of the mind which is still flesh and vulnerable to attacks from without and within.
This issue of living with sin is difficult to accept since we, meaning our self, has been sanctified and separated from the consequences of sin. Self now abides in Christ and is the will that agrees with Christ our Lord and Savior. John tried to express it in terms we might understand.
1 John 1:5-6 English Standard Version
5 This is the message we have heard from him and proclaim to you, that God is light, and in him is no darkness at all. 6 If we say we have fellowship with him while we walk in darkness, we lie and do not practice the truth.
Practicing the truth is obedience of faith and as Paul points out so painfully, we do not always practice what we preach. Walking in darkness is going our own way and not allowing Christ to lead us in truth. It happens because the mind, which is flesh, being subjected to influences, will sometimes make back choices.
If we justify those choices we become self-righteous.