In The Name of Allaah, The Most Merciful, The Bestower of Mercy
Staying within the boundaries of Halaal and Haraam, and not coming close to the doubtful matters depends on the righteousness or corruption of a person’s heart. If the heart has that fear of falling into doubtful matters which can harm a person in the afterlife and is pious, it will distance itself from haraam and that which leads to Haraam. However, if the heart is corrupt, it will not care about falling into [error]. If the sickness in the heart is not too much, the heart engages in doubtful matters; and if the sickness increases, the heart engages in Haraam. If the corruption in the heart is not too much, the heart will not be safeguarded against the doubtful matters; and if the corruption is too much, the heart will not be safeguarded against what is forbidden. This shows the importance of rectifying one’s heart.
[Source: Sharh Al-Arba’een’ lecture number 9 (at 17 mins onwards)-By Shaikh Abdur Razzaaq Al-Badr (may Allaah preserve him). Slightly Paraphrased]