Thoughts and delusions that are not compatible with religion do not bother a dead heart, because such a heart is already lifeless and ruined and that is all that Satan wants. It was said to one of the pious predecessors: “The Jews and Christians say that they do not suffer from the problem of waswas (insinuous whispers).” He replied: “They are speaking the truth, for what would Satan want with a house that is in ruins?”
On the other hand, if the heart is lively and contains a degree of eeman (faith, belief), Satan will launch a merciless and relentless war against it and will inflict upon it contradictory insinuations about the religion of its owner. This war can be highly destructive if the person succumbs to it.
Satan will go to the extent of making the person skeptical about his or her Lord, religion, and belief. If Satan senses any weakness or defeat in the heart, he will prevail upon it until he drags it to apostasy. But if he finds the heart to be powerful and resistant, he will be disgraced and badly defeated. Nevertheless, all the devilish insinuations that Satan casts on the heart will be ineffective if one uses the cures recommended by the Prophet ﷺ.
Ibn ‘Abbas (May Allah be pleased with him) reported that a man came to the Prophet ﷺ and said: “I experience thoughts about things regarding which I would prefer to become charcoal or ashes than to utter them.” The Prophet ﷺ replied: “Praise be to Allah, Who has sent Satan’s trick back to him.” (An authentic hadith recorded by Abu Dawood and Imam Ahmad)
In another hadith, some of the Companions came to the Messenger of Allah ﷺ and said: “O Messenger of Allah! We get some thoughts in our minds which we consider too awful to express.” The Prophet ﷺ answered: “Is that so?”. They replied: “Yes”. Then he ﷺ said: “That is pure eeman.” (Recorded by Muslim) It is as if the Prophet ﷺ were telling his Companions: ‘The meaning of it being pure eeman is that these emerging insinuations and your shunning of them and regarding them as too horrible will cause no harm to your eeman but it is rather an indication that your eeman is pure and unadulterated.”
The Prophet ﷺ is reported to have said: “Satan may come to one of you and say: Who created so-and-so? Until he says: Who created your Lord? So when he inspires such a question, one should seek refuge with Allah (by saying the istiaadha) and give up such thoughts.” (Recorded by Bukhari and Muslim)
In another version, the Prophet ﷺ said: “One should then say: I believe in Allah and His Messenger.” (Recorded by Muslim)
The Prophet ﷺ also said “The people will nearly ask too many questions, so that one of them may say: ‘Allah created all of creation, but who created Allah?’ If they say this, then say: (Say: He is Allah, [Who is) One, Allah the Eternal Refuge. He neither begets nor is born, nor is there to Him any equivalent.) (Quran 112: 1-4), spit (without actually releasing spittle) to your left three times, and seek refuge with Allah from the devil.” (A sound hadith according to as-Suyooti)
In all the aforementioned hadiths, the Companions (may Allah be pleased with them all) described the disease to the Prophet ﷺ and he in turn prescribed the treatment for it in the following four actions:
1. Shunning these insinuations entirely, forgetting them as if they had not existed at all and preoccupying oneself with safe thoughts
2. Seeking refuge with Allah from the thoughts and from the accursed Satan
3. Saying the phrase: “I believe in Allah and His Messenger”.
4. Reciting Surah-al-Ikhlaas: (Say: He is Allah, [who is) One. Allah the Eternal Refuge. He neither begets nor is born, nor is there to Him any equivalent.) (Qur’an 112: 1-4) then spitting drily (without spittle) to the left side three times saying: “A ‘oodhu billahi min ash-Shaytan ir-rajeem. (I seek refuge with Allah from Satan, the accursed).”
Reference: Youth Problems by Shaykh Uthaymeen