How to Get Rid of Devilish Whispers
Question

I have a serious problem. I was learning more about Islam, but now, as exams are drawing near, I am developing unutterable doubts and confusion. What I mean is doubts such as: was Muhammad (blessings and peace of Allah be upon him) really a prophet? And things of this nature. I can no longer focus on my studies. Please advise me.
Praise be to Allah.It is good that you are worried about yourself, it is good that you are upset about what you are suffering from, and it is good that you have written to us, asking for advice. This indicates that your heart is alert and cautious. We ask Allah to help you to do that which pleases Him.
Issues related to Devilish whispers in Islam
This state in which you find yourself is what is called OCD (Obsessive Compulsive Disorder). We would like to reassure you and lift your spirits by noting the following:

These whispers have no implications, and no rulings are based on them. Therefore no divorce is valid, no oath is binding, no state of purity is rendered invalid, and no Muslim becomes an apostate if the whispers have to do with some fundamentals of belief. So if a person is overwhelmed with whispers to the point that he begins to doubt the existence of Allah or his belief in the Prophet Muhammad (blessings and peace of Allah be upon him), none of that has any impact on him, and the ruling of his being a Muslim remains valid. Therefore you may rest assured, and let the devil die in his distress and suppression.

Abu Hurayrah (may Allah be pleased with him) said: The Prophet (blessings and peace of Allah be upon him) said: “Allah has forgiven my Ummah for whatever whispers [Waswasah] cross their minds so long as they do not act upon it or speak of it.” (Narrated by Al-Bukhari, 2391, and Muslim, 127)
Ibn Hajar (may Allah have mercy on him) said:
“What we may understand is that there is no blame for what crosses a person’s mind, unless it is translated into actions or words as a result of that thought. What is meant by whispers is when a thought resides in a person’s mind without him feeling happy with it, or it takes root in his mind.” (Fat-h Al-Bari, 5/161)
For some important details mentioned by Shaykh Al-’Uthaymin, please see the answer to question no. 10160 , where he stated that no harm will befall a Muslim if he experiences compulsive whispers about Allah and His existence, or about His Messenger (blessings and peace of Allah be upon him) or His religion.

These whispers are indicative – in sha Allah – of strong faith and certainty, because of which the devil is eager to subject you to this Waswasah . Were it not that he sees that you have strong faith and are righteous, he would not have resorted to this method of whispering, especially since you regard as abhorrent the thoughts that he is trying to instil in your mind.

We are not saying that just to be nice to you; rather this is what the Prophet (blessings and peace of Allah be upon him) stated, and it is what the trustworthy scholars of this Ummah understood from the Hadiths.
Abu Hurayrah (may Allah be pleased with him) narrated that the Messenger of Allah (blessings and peace of Allah be upon him) said: “The devil may come to one of you and say: ‘Who created such and such, who created such and such?’ Until he says to him: ‘Who created your Lord? ’ If it goes that far, let him seek refuge with Allah and stop (such thoughts).” (Narrated by Al-Bukhari, 3102, and Muslim, 134).
According to a report narrated by Muslim, “…let him say, ‘I believe in Allah and His Messenger.’”
According to another report from Abu Hurayrah (may Allah be pleased with him), he said: Some of the companions of the Prophet (blessings and peace of Allah be upon him) came and asked him: We find in our hearts thoughts that are too awful for any of us to speak of them. He said: “Do you really find that?” They said: Yes. He said: “That is [a sign of] clear faith.”.
An-Nawawi (may Allah have mercy on him) said:
“What this means is that the devil only resorts to whispering to those whom he despairs of ever misleading. So he tries to annoy them with his whispers, because he is unable to misguide them. As for the disbeliever, he can lead him in any direction he wants, and in that case he is not limited to whispering; rather he toys with him however he wishes. This is what the Hadith means: the cause of the Waswasah is strong faith or, in other words, Waswasah is indicative of a person’s strong faith. This is the view favoured by Al-Qadi `Iyad.” (Sharh Muslim, 2/154)
How to get rid of Devilish whispers
The remedy for this Waswasah is very simple. All you have to do is adhere to the instructions of the Prophet (blessings and peace of Allah be upon him) to stop going along with those whispers, ignore them , seek refuge with Allah , say “I believe in Allah,” and distract yourself from it by glorifying Allah, may He be Exalted, remembering Him and calling upon Him, and sending blessings upon the Prophet (blessings and peace of Allah be upon him).
An-Nawawi (may Allah have mercy on him) said:
“With regard to the words of the Prophet (blessings and peace of Allah be upon him): “let him seek refuge with Allah and stop (such thoughts)”, what is meant is: If he is faced with these whispers, let him turn to Allah, may He be Exalted, to help him ward off this evil. He should stop thinking about it and should realise that this thought is one of the whispers of the Shaytaan , who is only trying to corrupt him and mislead him. So let him stop listening to these whispers and hasten to put a stop to it by focusing on something else. And Allah knows best.” (Sharh Muslim, 2/155-156)
The scholars of the Standing Committee were asked:
I am a young Muslim man who has recently become religiously committed, and the Shaytan is causing me a great deal of trouble. Every time I manage to overcome one thing, he presents me with another obstacle. After I attained a level of religious commitment and I thought – praise be to Allah – that I was a little better than those around me, I began to see those who I had thought were less committed than me as now being better than me, and doing more righteous deeds than me; I look at myself and I find myself to be going downhill fast, drifting away from the level of commitment that I had achieved. I am trying to resist my evil inclinations and the Shaytan by all possible means, but I cannot find anyone who appreciates my pain and the suffering that I am enduring silently, or anyone I can talk to about the evil thoughts that the Shaytan is putting into my mind. These whispers do not leave me even for a minute, no matter what I do or where I am, in the mosque, in the street, at home or in school. Is there anyone who could stand by me and help me against this Shaytan? Is there anyone whom Allah might inspire to help me?
They replied:
“We advise you to ignore these whispers and to pay no attention to them, to read a great deal of Quran, do a lot of righteous deeds, and turn to Allah, beseeching Him and calling upon Him to ward off from you the tricks of the Shaytan, to make you steadfast in adhering to the truth, and to guide you. For He, may He be Glorified, is in control of all creatures, both jinn and humans, and He directs them as He wills.
Beware of being filled with self-admiration because of your worship , or being deceived by your good behaviour and conduct or your many righteous deeds.
When it comes to matters of worship and issues connected to the Hereafter, do not look at those who are less than you, for that will lead to you developing self-admiration and will cause you to do fewer righteous deeds and to become slow in doing them; it will cause the Shaytan to toy with you and discourage you from doing good. Rather you should look at those who are better than you in adhering to the Book of Allah and the Sunnah of His Messenger (blessings and peace of Allah be upon him).
Cling to that and be keen to adhere to it, for that will motivate you to increase your righteous deeds and help you to attain the forgiveness and mercy of Allah, and a high position in Paradise, and everlasting bliss. Perhaps Allah will make you steadfast in adhering to the truth and will guide you to the straight path, and will relieve you of this Waswasah.
We also advise you to read the book Talbis Iblis, by Abu Al-Faraj ibn Al-Jawzi, in which he discusses this issue. We hope that Allah will benefit you thereby.” (Shaykh `Abd Al-`Azeez ibn Baz, Shaykh `Abd Ar-Razzaq `Afeefi, Shaykh `Abdullah ibn Ghadyan, Shaykh `Abdullah ibn Qa`ud, Fatawa Al-Lajnah Ad-Da’imah, 2/194)
You should not worry, after reading these glad tidings and reassuring words, for all you have to do now is follow the advice of the scholars, which is based on the advice of the Prophet (blessings and peace of Allah be upon him). We ask Allah to protect you from the Shaytaan and to make what is good easy for you, wherever it may be.
And Allah knows best.