We now come upon a vexing problem. Is it better to have sinned and to then do heartfelt teshuva, or better to have not sinned at all? The short answer is: it depends. So let’s explore the particulars.
First off, suppose you’d neglected to fulfill a relatively minor imperative (e.g., you didn’t wear tzitzit that day). While that isn’t the worst thing and it doesn’t at all compare to actually doing something you shouldn’t do, it’s still and all a significant-enough breach. But you’d only need to engage in heartfelt teshuva and to try to never neglect that imperative again and G- d will indeed forgive you. And we’re taught that you’d then be on par with someone who’d never neglected it.
Now, if you’d done something relatively minor that you *shouldn’t* have done (e.g., you turned off a light on Shabbat) and you then engage in full, heartfelt teshuva; and as Ibn Pakudah puts it, you become someone who’s “always aware of his sin, constantly asks to be forgiven for it, is embarrassed before the Creator, fears punishment, is brokenhearted, surrenders and humbles to Gd because of the sin and tries to repay his debt to the Creator becoming arrogant in any way for his deeds, and does that all without seeing his (other, good) actions as more than they are, without taking credit for them, and is careful not to stumble the rest of his life” — then you’d in fact be *greater yet* than someone who never sinned that way.
Why? Because “there’s no guarantee that the (otherwise) righteous person won’t become conceited, or that his heart won’t be pleased with (the other, good things) he’d done”. And since there’s nothing worse, Ibn Pakudah says here, than arrogance and hypocrisy, we’d rank the otherwise-righteous person below the one who’d sinned but then truly and *humbly* repented.
But if you’d done something *seriously wrong* that you shouldn’t have done (e.g., you profaned G-d’s name), then even if you did heartfelt teshuva and went through all the stages we’d cited before, you wouldn’t be absolved of your sin right away. You’d have to withstand some sorts of exculpating trials and tribulations at some point to utterly purge your being of that grave error. And you’d be inferior to anyone who’d never done such a thing, despite your thorough teshuva.