Masturbating and not being able to stop

Question
The questioner asks, He is a young man who diligently observes his prayer, Praise be to Allaah; however, he regularly masturbates. He tries to stop but cannot. What do you advise him to do? Is it prohibited?
Answer

Yes. The established opinion according to scholars is that masturbation is prohibited. Allaah says,

(إِلَّا عَلَىٰٓ أَزۡوَٰجِهِمۡ أَوۡ مَا مَلَكَتۡ أَيۡمَٰنُهُمۡ فَإِنَّهُمۡ غَيۡرُ مَلُومِينَ ‘وَٱلَّذِينَ هُمۡ لِفُرُوجِهِمۡ حَٰفِظُونَ)
… and they who guard their private parts except from their wives or those their right hands possess, for indeed, they will not be blamed.” (Al-Mu’minoon 5-6)

There is no doubt that masturbation is not from the ways of lawful sexual outlet and falls under the category of transgression, and therefore it is unlawful. Furthermore, those who expose themselves to trials such as frequenting shopping malls where there are inappropriately dressed women, or they watch television channels presented by female presenters or actors, should fear Allaah, Most Exalted and High. They should not expose themselves to temptation, and they should fear Allaah regarding themselves. There is no doubt that masturbation is regarded as prohibited according to scholars. However, if a person fears that they will fall into sin and there is no way to relieve himself, then the lesser of the two evils should be taken as the least harmful option. However, this should not be taken lightly and regarded as lawful. That is to say, masturbation is only permitted when the need is at its highest peak and no other option is available. This has happened without intending to see something which caused sexual arousal and there is no way to control the urge but to relieve himself through masturbation. Then, it is allowed. However, repentance, remorse and seeking forgiveness is still necessary.