Imām Ibn Taimiyyah, may Allāh have mercy on him, said:
Evil deeds happen only when there’s a weakness in good deeds that prevent them, as the Prophet ﷺ said:
A fornicator doesn’t fornicate at the time of his fornicating while he’s a believer [in full]; a thief doesn’t steal at the time of his stealing while he’s a believer¹ [in full]; and a [person] doesn’t drink wine at the time of his drinking while he’s a believer [in full].²
For indeed, the perfection of īmān and its true reality prevents [evil deeds], so they don’t occur other than when there’s some kind of weakness in [a person’s] īmān causing it to lose its perfection.
¹a person of īmān; īmān is speech, action, and beliefs; it increases with acts of obedience to Allāh and decreases with acts of disobedience to Him (trans.)
²Rated ṣaḥīḥ (authentic) by Al-Albānī, Ṣaḥīḥ Al-Jāmiʿ Al-Ṣaghīr, no. 7706 (trans.)
Majmū Al-Fatāwá, vol. 20, p. 124.