Does God answer one who was tempted by a woman of status and beauty, but turned away from the grave sin of fornication out of fear of God, and used masturbation to alleviate his desire? Is he sinful for this action, and will he be rewarded for his avoidance of fornication?
Praise be to Allah, who has kept you firm on the path of chastity and averted from you this great sin. We ask Him, the Almighty, to grant you continuous well-being and to protect you from the stratagems of the devils among jinn and humans. Your turning away from this indecency out of fear of Allah, the Almighty, is one of the greatest acts of obedience and one of the reasons for achieving Allah's shade on the Day of Judgment, as stated in the agreed-upon Hadith: "Seven are shaded by Allah in His shade on a day when there is no shade but His... and a man who was tempted by a woman of high status and beauty, but he said: 'Indeed, I fear Allah, Lord of the worlds.'"
If it is established that this act is a righteous deed, then supplicating to Allah, the Almighty, by means of it to attain a blessing or avert a misfortune is permissible, as indicated by the Hadith of the three men trapped in the cave by a rock, each of whom supplicated to Allah by means of a righteous deed, and Allah saved them. It is stated in Fath al-Bari by Ibn Hajar: "In this Hadith, there is a recommendation to supplicate during distress and to draw closer to Allah by mentioning a righteous deed and by seeking the fulfillment of His promise through supplication." Therefore, there is no harm in you supplicating to Allah by means of this act to grant you marriage to the one you love.
As for masturbation, it is a forbidden habit. However, if it becomes the only way to break sexual urges, fearing falling into fornication, and the person is on the verge of committing fornication, and there is no other way to avert the indecency except through it, then it is permissible for him at that time. This falls under the principle of committing the lesser of two harms, and the doer is not sinful in this case, because in a state of necessity, sin is lifted. However, if you have not reached this degree of necessity, then you must seek Allah's forgiveness for it. And Allah knows best.
Summarized from the full answer at Ftawy · reviewed Sep 2, 2026
Read the full answer on Ftawyhttps://ftawy.com/en/questions/103119