Answer
(Fatwa: 1159/1029=D/1429)
We pray to Allah for you that you may get rid of this wicked act. You yourself should pray to Allah for the same and pledge with firm determination not to do this bad act in future. Because of this very act, some previous nations have been punished. It is in the Hadith that some people will be resurrected in the Day of Judgment with their hands pregnant i.e. those who play with their private parts through their hands. You should think of disgust, vice and harm of this evil deed. Whenever, such feelings come to your mind, you should turn away your mind from that and engross yourself in doing some thing else. You should strive hard to keep your eyes, heart and mind free form casting an evil look and having bad thoughts. Before going to bed, you should meditate for awhile, ponder over bad effects of this act, do repentance, seek forgiveness of Allah and pray Him to protect you form it.
Allah (Subhana Wa Ta’ala) knows Best
Darul Ifta,
Darul Uloom Deoband