How Do I Control My Porn Addiction and Horrible Thoughts about Allah?

Answered by Shaykh Faraz A. Khan


I am a young man and have recently suffered a few physical injuries, as well as some psychiatric problems of extreme loneliness and OCD. I tried getting into Islam and stopped most of my unlawful activities, yet recently fell back into committing major sins, including pornography.

Are movies allowed in Islam?

Also, I get horrible thoughts regarding Allah, and sometimes while praying, the thought comes to me that I am praying to the devil. The waswasa brings me to tears. Please help.


I pray this finds you in the best of health and state.

May Allah make this ordeal easy for you and grant you the strength and courage you need to overcome your trials. Below are some key aspects of our religion that might prove helpful for you in this stage of your life; I pray it is of benefit to you.

I would also like to preface this advice by stating that Obsessive-Compulsive Disorder (OCD) is a serious mental illness for which a person should seek appropriate psychiatric counseling and medical treatment. It is not something to be ashamed of or embarrassed about: it is a trial from Allah, like any other trial.

Dealing with Trials

Do not lose hope because of the trials you face. Trials are either an expiation for sins or a means of raising one’s degrees in Allah’s sight. And scholars mention that our trials are filled with subtle blessings that we do not perceive but that are nevertheless there.

Our Master Ibn Ata’illah says, “Whoever deems His subtle kindness to be severed from that which He decrees, then that only reflects one’s shortsightedness.” The true believer, then, is the one who can find that grace amidst the trial — he sees far, well beyond the immediacy of this life, and his scope is broadened, thus enabling him to rely on Allah during the trial.

Our Master Umar (Allah be pleased with him) highlighted some of the blessings of trials when he once said, “I was never afflicted with a tribulation except that with it Allah gave me four blessings: it was not in my religion; I was not barred from being content; it was not worse than it was, and I hoped for reward through it.”

Umar (Allah be pleased with him) was able to appreciate these blessings only because he was realized in the statement of Allah Most High, “Perhaps you may hate something, yet it proves better for you.” (2:216)

And this realization was a result of his having accompanied the best of creation (peace and blessings be upon him), who confirmed this reality when he said, “How amazing is the believer’s affair! Allah decrees nothing for the servant except that it is good for him.” [Musnad Ahmed]

Divine Wisdom and Having a Good Opinion of Allah

Also, with respect to trials, one must always remember that nothing exists except that it reflects Allah’s infinite wisdom, for He has called Himself ‘The All-Wise’ (Al-Hakim).

There is always the big picture, a larger context that we are often unable to perceive. Allah Most High is fully aware of how things unfold in the long run, and we must place our trust in Him, fully realizing that there is wisdom in His decisions.

Indeed, our Prophet (peace and blessings be upon him) advised us to maintain the very best opinion of our Lord and to expect only the good from what He decrees. Allah Most High Himself states, “I am in my servant’s opinion.” [Bukhari]

If we are convinced that Allah is looking out for our best interests when He decrees painful situations and that He will replace what is lost with something much better for us in both this life and the next, then that is exactly how we will find Him, without a doubt.

Reflecting on Those Less Fortunate

Furthermore, the Prophet (peace and blessings be upon him) gave us a powerful mental tool to help deal with trials, as he said, “Look towards those who are below you, not towards those who are above you, for indeed, that is more conducive to your not belittling the blessing of Allah upon you.” [Muslim]

This is immense wisdom that we should hold firmly to when we are dealing with the struggles in our lives. Today for example, we need only reflect on the situation of those less fortunate than us: people in severe famine who sometimes have to see their infants die before their very eyes due to lack of basic food, people under oppressive governmental regimes who lack security and freedom, people who have lost all their property due to flooding or earthquakes, people who have seen their families killed or transgressed upon by tyrants, people who have no housing and therefore live under bridges, people who get into major car accidents and are paralyzed for life, etc.

We could list many other examples, yet these few should suffice us in making us appreciate that, despite the trials we face, things could be much, much worse. Perhaps you should consider visiting those around you who are less fortunate: go to the local homeless shelter or cancer ward, and sit with the people there. Spend time with them, serve them, and count the innumerable blessings that you have in your life.

The Gift of Patience

Our Prophet (peace and blessings be upon him) taught us that “Patience is a glowing illumination” [Muslim], and that “No fatigue, illness, anxiety, sorrow, harm or sadness afflicts a Muslim — not even a thorn that pricks him — except that Allah wipes out his sins by it.” [Bukhari, Muslim]

Of course, patience is not only the key to dealing with the struggles of life, but it is also the characteristic that enables us to avoid crossing the limits set down by Allah and falling into sin.

In this regard, if you find it difficult to be patient, then simply work on it and force yourself to be patient, as that itself will inculcate patience. Our Prophet (peace and blessings be upon him) said, “Whoever forces himself to be patient will be granted patience by Allah.” And what a great gift from Allah! Indeed, the Prophet (peace and blessings be upon him) said immediately afterward, “No one was given a better and more expansive gift than patience.” [Bukhari, Muslim]

Do your Best and Rejoice

Allah Most High says, “When My servant draws near to Me by a handspan, I draw near to him by an arm’s length, and when My servant draws near to Me by an arm’s length, I draw near to him by two arms’ length, and when he comes to Me walking, I come to him rushing.” [Bukhari]

If you take on this struggle for Allah the Exalted, to rid yourself of major sins and be truly patient with your trials, Allah will rush to you — with His concern, with His favor, with His acceptance, with His good pleasure, and with His love. You will find unforeseen provisions and unexpected gifts in your life, not to mention what will await you in the afterlife. Do your best, and rely on Him.

The Prophet (peace and blessings be upon him) said, “Verily this religion is ease, and no one shall make the religion difficult except that it will destroy him. So do what is correct, try your best, and rejoice!” [Bukhari] Notice how the Prophet ended with the command to rejoice, yet didn’t mention what to rejoice over, as an indication of the immensity and greatness of the blessings of doing what is correct and trying one’s best. [Ibn Hajar, Fath al-Bari] Above all, we should rejoice in Allah’s mercy and acceptance of repentance.

Allah’s Vast Mercy and the Vast Door of Repentance

If you find yourself repeatedly falling into major sins, remember that the doors of repentance and divine mercy are always open. No matter how grave the servant’s crime, the servant can at any time turn back to his Generous Lord and find Him Ever-relenting.

Amazingly enough, our Messenger (peace and blessings be upon him) even described an actual door in the direction of the West of Medina through which repentance goes through to be accepted, a door so vast that it would take a rider 70 years to cross it! This vastness indicates to us that no matter how many sins we have committed, and no matter how grave those sins are, there is plenty of room for repentance. This door, by Allah’s grace, shall remain open until the sun rises from the West. [Tirmidhi, Nasa’i]

Surely, there is no room for despair in our religion. Allah Most High states, “Say: ‘O My servants who have transgressed against their own souls! Despair not of the mercy of Allah! For Allah forgives all sins: indeed He is Oft-Forgiving, Most Merciful.'” (39:53)

And Allah not only loves for the servant to turn back to Him but rather is overjoyed at his repentance, as the Prophet (peace and blessings be upon him) explained:

“Allah has greater joy at the repentance of one of His slaves at the time he returns to Him than if one of you were on his riding mount in the middle of the desert, only to have it escape from him with his food and drink. So he despairs of it and comes to a tree to recline in its shade, in utter despair over losing his mount, when… Lo and behold! There it is, standing right in front of him! So he takes it by its reigns and exclaims out of intense excitement, ‘O Allah, You are my slave, and I am your Lord!’ He makes a mistake out of such intense joy!” [Muslim]

Keeping Good Company

Directly related to repentance is the divine mandate to seek out good company, since after one has decided to change his old ways and turn back towards his Lord, he must be in an environment that is conducive to his new direction in life. This connection between repentance and finding good company is evident in the narration in which our Prophet (peace and blessings be upon him) describes a man who, after having killed 100 men, was told to leave the town where those sins took place and move to a new town. [Bukhari, Muslim]

You must find company that will elevate your spiritual state. This is one of the most central foundational principles in one’s relationship with Allah Most High — it cannot be taken lightly, and it cannot be emphasized enough. Allah Most High commands us to seek the best of company as He says, “O you who believe! Fear Allah, and be with the sincere and truthful.” (9:119)

Our Beloved Messenger (peace and blessings be upon him) reinforced this divine injunction when he advised his community, “A person is on the religion of his close friend, so let him carefully examine whom he befriends,” and he also said, “Do not keep company except with a true believer and let not anyone eat your food except one who is godfearing.” Tirmidhi, Abu Dawud]

You should spend time with believers that are strong-willed and of good character, people who remind you of Allah Most High. Many times we cannot even perceive how we benefit from the people of Allah’s remembrance, yet there is no doubt a profound effect of keeping their company. The same applies to the harm of sitting with bad company — it is often slow, gradual, and hence unnoticed.

The Prophet (peace and blessings be upon him) alluded to this with a beautiful metaphor when he said, “The example of a good companion and a bad companion is like a carrier of musk and one who blows the bellows of a blacksmith. The carrier of musk either gives it to you, or you buy some from him, or at the very least, you smell its sweet fragrance. The one who blows the bellows of a blacksmith either burns your clothes or you get from him a foul stench.” [Bukhari, Muslim]

Finally, we must realize that company in our times includes virtual company: the websites we visit and the images we see there are often “bellows of blacksmiths covered in soot,” leaving our hearts enveloped in foul stench and burnt garments. It is only Satan and his devilish insinuations, coupled with the lower self and its unbridled passions, that drive so many of our young people to keep such wretched virtual company and sully their precious hearts.

Warding Off the Devil

The devil is a trickster, and deceit is his profession. He has been in business for as long as humans have existed. He is cunning and crafty, and he works very hard to achieve his goals. He has many tactics, at the top of the list being baseless misgivings and creating doubts in our minds and hearts. He wants us to become confused and obsessed to the extent that it destroys us. He knows our psychological makeup very, very well.

Take the means to ward off the devil, as taught by our Messenger (peace and blessings be upon him). These include the following:

  1. Seek refuge in Allah Most High, by saying, “A‘udhu bi Llahi min ash-shaytani r-rajim” [Bukhari, Muslim]; and recite Ayat al-Kursi, as well as the last three surahs (Ikhlas, Falaq, Nas). [Tabarani, al-Mu‘jam al-Kabir]
  2. Ignore any thoughts or fleeting notions of disbelief: these are from the Devil, and he hates to be ignored. Every time you get such a thought, remember Allah and seek His refuge. Go to Allah, broken and weak, and He will fix you and grant you strength.
  3. Be consistent in the remembrance of Allah (dhikr), especially when you are on the Internet. When you get online, begin with Allah’s name by saying the basmala, and couple this with sending much salutation and blessings upon the Prophet (peace and blessings be upon him). While you are online, continue to remember Allah and keep your tongue moist with His remembrance, especially by sending salutations upon the Prophet (peace and blessings be upon him).
  4. Maintain a strong relationship with the Qur’an, reading some portion daily, however little. Make sure you pray all five prayers on time and try to attend the mosque for as many of the five as you can. When one regularly attends the mosque, it is more difficult to engage in sinful activity between prayers. Allah Most High states, “Recite that which has been revealed to you of the Book and regularly establish the prayer: surely, prayer keeps one away from indecency and evil. Indeed, Allah’s remembrance [of the servant] is greater yet, and Allah knows all that you do.” [Quran, 29:45]
  5. Learn sacred knowledge under righteous scholars, so you know the reality of the Sacred Law and its limits. Implement what you learn. The more sound knowledge one has of the religion, the more empowered one is to deal with Satan’s prodding.
  6. (f) Seek Allah’s help in warding off the devil, whose whisperings are in reality of no power or consequence. Allah is in full control. Allah created the devil to spur us forward in our journey to Him Most High. Make supplication (dua) to Allah, and observe the various etiquettes of dua, such as eating lawful and wholesome food, praying with sincerity and focus, and being certain that Allah will answer your dua.

A more complete discussion on the etiquette of dua can be found here:
Struggling to Have Children: Ten Key Etiquettes of Du’a

Some Final Advice

It’s time to really roll up your sleeves and be strong for the sake of Allah. Our Beloved Messenger (peace and blessings upon him) said, “The strong believer is better and more beloved to Allah than the weak believer, yet it is good in both. Be avid for what benefits you, seek Allah’s help, and don’t be weak.” [Muslim]

Notice — may Allah have mercy on you — how the Prophet (peace and blessings upon him) first stated the merit of being strong and then followed the statement with the very means to gain strength:

  1. being avid for the beneficial and
  2. seeking Allah’s help.

Don’t merely do the beneficial, but be keen and avid for it: determine what benefits you, seek it out, and hold firmly to it once you find it. Then rely on Allah and seek His aid alone, for there is no might or strength except Him.

Masha’Allah, you have already taken the first step of recognizing your problems and having a sincere desire to quit, and this is not to be underestimated. It is a very praiseworthy thing for someone with a problem or addiction to at least admit he has a problem and genuinely want to rid himself of it. Have hope in Allah that with each step you take towards Him, He will take ten towards you.

Also, regarding movies, the legal ruling would depend on their content, although most movies have unlawful content and are hence unlawful.

Lastly, please see the following related answer. Although it deals specifically with homosexual feelings and gay pornography, much of its advice can help with any Internet addiction:

Tackling Homosexual Feelings: Supplication, Repentance, and Going Cold Turkey

Related Answers:
A Reader on Patience and Reliance on Allah

And Allah knows best.
[Shaykh] Faraz A. Khan
Checked and Approved by Shaykh Faraz Rabbani