Thoughts which cross the heart are called Khawaatir (singular Khaatir). Such thoughts are at times virtuous and at times evil. These thoughts emanate from different sources. Virtue is inspired into the heart sometimes by Allah Ta'ala, sometimes by an Angel whose name is Mulhim and sometimes virtue is whispered into the heart by even Shaitaan. Evil assaulting the heart sometimes emanates from Shaitaan, sometimes from the nafs and at times from Allah Ta'ala.
Pious inspirations from Allah Ta'ala serve the purpose of honouring one or for establishing some proof. The evil Khaatir which comes from Allah Ta'ala appears as a test and to impose some labour and effort on one. From the Angel Mulhim emanates always only goodness since this is his function. His function is to guide towards virtue.
Khaatir (virtue or the good thought) emerging from Shaitaan is deception. He casts his trickery in the form of a good thought, but in reality it is evil designed to divert one from a greater virtue by involving one in a lesser virtue. The purpose of evil emanating from Shaitaan is to deceive and disgrace man.
A good thought having the following ingredients is from Shaitaan:
It produces total delight-delight unchecked by Khauf (fear).
It demands haste. The haste it wants is unchecked.
It pertains to something, the consequences of which are not at all considered.
The following five occasions are excluded from this rule:
Payment of a debt.
Burial of the dead.
Feeding the visitor.
Repenting for sins.
If the good thought is accompanied by delight tempered with Khauf (fear) and one is concerned about the consequences of the act if it is translated into practice, then such thought of virtue is from Allah Ta'ala. It has also been said that such a thought is from the Angel Mulhim.
N.B. Khauf in the context of this discussion means concern and anxiety to render the virtue fully, and perfectly, observing all the required rules and Aadaab pertaining to that act, the thought of which has occurred. At the same time one is anxious in regard to the acceptance of the deed--will Allah Ta'ala accept it or reject it? The meaning of being concerned about the consequences is in relation to guidance, virtue and hope for thawaab in the Aakhirah. There should be no other motive.
Mulhim is the name of an angel who occupies the right side of the heart while Waswaas is the name of a Shaitaan who occupies the left side of the heart of man. The Hadith explains this: "When man is born Allah Ta'ala creates an angel and a Shaitaan along with him. The Shaitaan makes his abode on the left side of man's heart and the angel settles on the right side. Both then call towards man."
Some effort, concern and Zikr (among which the recitation of Laa Haulaa Walaa Quwwat is very efficacious) will suffice to ward off the thought of Shaitaan. Allah Ta'ala states: "Verily, the scheme of Shaitaan is weak."
The best remedy for the Waswasah (thoughts and whisperings) of Shaitaan is to totally ignore these. How will one know that one is ignoring such thoughts of Shaitaan? The recognition of this is that one will not be un-duly bothered or vexed when such thoughts assault one. The state of indifference which existed prior to the entry of satanic Waswasah should also prevail after these thoughts have entered the heart. In fact, the occurrence of satanic Waswasah is proof of one's Imaan. Such assaults should therefore be a cause of happiness and not sorrow. When the Sahaabah RA explained their concern and vexation about these satanic thoughts which afflicted them, Rasulullah Sallallahu Alayhi Wasallam said: "This is clear evidence of Imaan." A thief makes an attempt only where there is something of value.