It is reported from Ibn Abbas (Allah be pleased with them) that the Prophet (Allah bless him & give him peace) reported from Allah Most High that, “Verily, Allah has written the good and the bad, and then explained it. So whoever inclines to perform a good deed but does not perform it, Allah writes it for him as a complete good deed. Then, if he inclined towards it and actually performs it, Allah writes it for him as ten good deeds to seven hundred time, to many times over. And if he inclines towards a bad deed but does not perform it, Allah writes it for him as a complete good deed. If he inclined towards it and then performed it, Allah writes it as one bad deed.” [Bukhari, 6010 & Muslim, 187]
Imam Zayn al-Din Ibn Nujaym, in his al-Ashbah wa al-Nadha’ir, explains that:
“The mere whisperings of the soul are not punished, unless one speaks or acts on them, as mentioned in the hadith in [Sahih] Muslim. The summary of what the scholars have discussed on this is that the thoughts of sin or good works that occur to the soul are of five levels:
1. The notion (hajis), which is that which occurs to it;
2. The thought (khatir), which is the notion going through it;
3. The whisperings of the soul (hadith al-nafs), which is the uncertainty it has as to whether to do something or not;
4. Inclination (hamm), which is to lean towards doing something;
5. Determination (`azm).
There is scholarly consensus that mere notions are not punished, for they are not from one s actions. As for thoughts and whisperings of the soul, even though one could avoid them by negating the notion as soon as it occurs, they are, however, not taken to account because of the authentic hadiths related to them
As for inclination, it has been explained in the authentic hadiths that inclining towards a good dead leads to a good dead being written for one, though if one [merely] inclines to a bad deed this is not written
As for determination, the scholars of verification hold that it is taken into account It is mentioned in al-Bazzaziyya that, ‘If one inclined towards committing sin, this is not sinful, unless one fixed one s determination on doing so. If one determined to do, one sins, but not the [complete] sin of the actual action.’” [Ibn Nujaym, al-Ashbah wa l Nadha ir]
This is in correspondence to what Ibn Hajar al-Asqalani (Allah have mercy on him) stated in his Fath al-Bari, commenting upon the hadith of Ibn Abbas. He stated that this was the position of Baqillani, and that Qadi Iyad stated that this was the position of the majority of the early Muslims and of the scholars.
And Allah alone gives success.