The ruling on masturbation is governed by some considerations that might change the ruling from one person to another.
The late prominent scholar Sheikh Mustafa Az-Zarqa, may Allah bless his soul, analyzed the issue of masturbation in detail and, after discussing the different views of scholars and jurists regarding it, issued the following fatwa:
“The only legal text used as evidence for the prohibition of masturbation is Allah’s saying describing the believers: “Those who guard their sexual organs except with their spouses or those whom their right hands possess, for (with regard to them) they are without blame. But those who crave something beyond that are transgressors.” (Al-Mu’minun: 5-7)
Commenting on this verse, some scholars hold the view that this habit (masturbation) falls under the category of those who seek fulfillment of their sexual desires outside the framework of marriage, and as such, they are deemed transgressors.
Those scholars put masturbation under the list of the forbidden categories of sexual fulfillment since it constitutes a transgression of boundaries. This view is held by the Shafi`ites (followers of the Shafi`i school of Fiqh).
However, some other scholars believe that the transgression meant in the aforementioned verse refers to extra-marital relations and what falls under the category of Zina (adultery). According to this view, masturbation does not fall under the meaning of this verse. This view is very close to the opinion held by the Hanafites (followers of the Hanafi school), who maintain that masturbation is basically forbidden, but it may be permissible under the following conditions:
1. if the person is unmarried,
2. if he or she fears that without masturbation he/she will commit Zina, and 3. if the masturbation here is, rather than fulfilling a sexual desire, just to release the sexual tension resulting from stimulation.
I conclude that the general principles of Shari`ah go against this habit because it is not the normal way of fulfilling sexual desire; however it is a deviation – and that is enough to condemn it, even though this act does not fall under the category of absolute prohibition like Zina. However, the law of necessity, which is one of the principles of Shari`ah, should also apply here. For example, if someone is afraid that he would commit a greater sin like Zina or he will be harmed by some psychological disorders, then the ban on masturbation would be relaxed just to remove the hardship, based on the Shari`ah principle that states that “necessity is judged according to the circumstances that warrant it.” That means going to the extreme in masturbating is not permissible in all cases, for the following two reasons:
1. it would be resorted to not as a case of extreme necessity to release the tension and the pain resulting from sexual arousal, but to fulfill the sexual desire, and
2. it is harmful to one’s health, and whatever is physically harmful is not allowed in Shari`ah, according to the consensus of Muslim scholars. In addition to the two conditions stipulated by the Hanafites, I would add two more conditions based on the general rules of Shari`ah:
1. the difficulty of getting married, and
2. The inability to fast. As we know, the Prophet, peace and blessings be upon him, has advised those who cannot afford marriage to fast, saying: “O youth, whoever of you is able to marry, let him marry, for it prevents forbidden stares or lapsing in adultery. And if he cannot marry, let him observe fasting, for it is a shield against evil.” (Sahih Al-Bukhari, English Translation, Vol. 7, Book 62, Hadith no. 4; Sahih Muslim, Book 008, Hadith no. 3231) This is the view I believe to be the most correct concerning this issue.”