अपि चेत्सुदुराचारो भजते मामनन्यभाक्।
साधुरेव स मन्तव्यः सम्यग्व्यवसितो हि सः
(Srimad Bhagavad Gita – 9:30)
Even if a man of very condemnable character worships Me with one-pointed devotion, with his mind not given to anybody else, he is to be considered verily good, as well behaved, for he has resolved rightly, has virtuous intentions.
English Commentary – Swami Sivananda
Even if the most sinful worships Him with undivided heart, he too must indeed be deemed righteous for he has made the holy resolution to give up the evil ways of his life. Rogue Ratnakar became Valmiki by his holy resolution. Jagai and Madhai also became righteous devotees. Mary Magdalene a woman of ill-fame, became a pious woman. Sin vanishes when thoughts of God arise in the mind. Chandrayana and Kricchra Vratas (atonements) will remove only certain particular sins but the remembrance of the Lord, thoughts of the Supreme Being, Japa and meditation, and Abheda Brahma Chintana will destroy the sins committed by a person even in hundred crores of Kalpas or ages.
By abandoning the evil ways in his external life and by the force of his internal right resolution, he becomes righteous and attains eternal peace.