God's dealing with his people
There is no soundness in my flesh because of thine anger; neither is there any rest in my bones because of my sin. Ps. 38:3
God does not deal with us a robots, but as the mind-heart-will personal beings that we are. In other words, God deals with us according to the natures and personalities that he has given us. And though we must not constrain God, as some do, and say that God's sovereignty is limited by the human will, neither must we say that God does an end-run around our wills. He works in them and through them. The same with our hearts and minds.
Hence, when it comes to the sin in our lives, we must be brought to see its ugliness and to smell its stench and to be put off from it. This does not happen automatically, but in accordance with our natures as thinking-feeling-willing beings. But God knows us better than we know ourselves and he knows what needs to happen to us and in us in order to get us there. And as a good Father, he will discipline us and help us to see our sin for what it is.
This is what was happening to David. He had sinned, and the Lord had brought discomfort into his heart and soul as well as enemies from without in order to put him off from his sin. Hence, through the loving providence of God, David was able to say, "For I will declare mine iniquity; I will be sorry for my sin" (18).
The same is true with us. God knows what needs to happen in you and to you and around you in order to bring you to a place of godly sorrow and true repentance. He knows how to work in you and around you so that the fruit of holiness appears in your life. And when he chastens us, as he did David, he does so "for our profit, that we might be partakers of his holiness." And though it is true that "no chastening for the present seemeth to be joyous, but grievous: nevertheless afterward it yieldeth the peaceable fruit of righteousness unto them which are exercised thereby" (Heb. 12:10-11).
Let us thank the Lord for his faithful and kind and wise shepherding of our souls, and know that our lot is given us of the Lord because he knows what we need in order to bring us closer to himself. And that is the greatest of gifts and the most precious of treasures.