First of all, the Muslim is not held accountable of the constant self-talk or idle thoughts that assail his minds and over which we have no control. However, a Muslim is accountable for deliberately dwelling on these thoughts and nurturing them in his mind, or formulating them into a firm determination or intention.
Elaborating on this issue, Sheikh Ahmad Kutty, a senior lecturer and Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, states: “Our thoughts can be divided into different categories:
1) the constant self-talk or idle thoughts that assail our minds and over which we have no control.
2) Thoughts that we dwell on.
3) Intentions that we formulate based on those thoughts.
We are not accountable for the first stage, namely the self-talk, since we have no control over it, unless we dwell on the thoughts and nurture them in our minds. We are accountable if we dwell on them. We are also accountable for the deliberate intentions that we formulate based on these thoughts.”
In addition, Sheikh `Atiyyah Saqr, former head of Al-Azhar Fatwa Committee, states:
“Allah Almighty does not account a person for his thoughts except in two cases:
First, if a person has firm determination to put into practice the thought in his mind. The evidence for this is the Prophet’s hadith: “If two Muslims meet each other with their swords, then (both) the killer and the killed one are in the (Hell) Fire.” I [the narrator] said, “O Allah’s Messenger! It is all right for the killer, but what about the killed one?” He said, “The killed one was eager to kill his opponent.” (Reported in Al-Bukhari and Muslim)
Second, once the person applies what he thinks of. The Prophet (peace and blessings be upon him) said, “Allah has forgiven my followers the evil thoughts that occur to their minds, as long as such thoughts are not put into action or uttered.” (Reported in the six authentic books of Hadith, and explained by Imam Ibn Kathir)
A person is accountable for his intention to do an evil deed that he couldn’t do due to inability or fear of authorities. But if he couldn’t do it due to piety and fear of Allah, then Allah would not account him for it. Instead, he may attain the reward of jihad an-nafs (striving against inner whims). This settles any assumed contradiction between textual evidence.”