I like the way C. S. Lewis deals with sin and forgiveness in the following passages. First, he unfolds how people often, but erroneously, think of it:
If you had a perfect excuse you would not need forgiveness: if the whole of your action needs forgiveness then there was no excuse for it. But the trouble is that what we call “asking God’s forgiveness,” very often really consists in asking God to accept our excuses. What leads us into this mistake is the fact that there usually is some amount of excuse, some “extenuating circumstances.” We are so very anxious to point these out to God (and to ourselves) that we are apt to forget the really important thing; that is, the bit left over, the bit which the excuses don’t cover, the bit which is inexcusable but not, thank God, unforgivable. . . .
What we have to take to him is the inexcusable bit, the sin.
He then zeroes in on the heart of receiving forgiveness, and what must come first:
The demand that God should forgive such a man [one bent on evil] while he remains what he is, is based on a confusion between condoning and forgiving. To condone an evil is simply to ignore it, to treat it as if it were good. But forgiveness needs to be accepted as well as offered if it is to be complete: and a man who admits no guilt can accept no forgiveness.
Acknowledgment of sin and a genuine turning from sin—a.k.a., repentance—are prerequisites to forgiveness.