Is it permissible to relieve intense and recurring sexual urges by rubbing against the bed, merely for the sake of relief and not for pleasure, bearing in mind one's religious commitment, attempts to marry, fast, and strive in work, all to no avail?
It has been previously stated that masturbation is originally haram (forbidden) and not permissible, except if a person fears committing zina (fornication/adultery) or experiencing harm that cannot be averted except by it, according to some scholars. The Kuwaiti Encyclopedia of Islamic Jurisprudence mentions its permissibility for soothing excessive lust that leads to the fear of zina; some even considered it obligatory because it falls under the category of a forbidden act that necessity permits, and choosing the lesser of two harms. There is another opinion from Imam Ahmad prohibiting it even if one fears zina, because fasting is an alternative, as is nocturnal emission. As for the Malikis, they have two tendencies: permissibility in cases of necessity, and prohibition due to the existence of an alternative (fasting). Ibn Abidin, from the Hanafis, explicitly stated its obligation if it is the only way to avoid zina. If the matter reaches this extent, then you have a dispensation to do it according to some jurists. If it does not reach this extent, then it is not permissible. Whenever you fall into it, renew your repentance to Allah and do not despair.
Summarized from the full answer at Ftawy · reviewed Sep 2, 2026
Read the full answer on Ftawyhttps://ftawy.com/en/questions/181872