Allah Almighty says: (Say: ‘O my Servants who have transgressed against their souls! Despair not of the Mercy of Allah: for Allah forgives all sins: for He is Oft-Forgiving, Most Merciful.) (Az-Zumar 39: 53) He Almighty also says: (Allah accepts the repentance of those who do evil in ignorance and repent soon afterwards; to them will Allah turn in mercy: For Allah is full of knowledge and wisdom.) (An-Nisa’ 4: 17)
As for Hajj, it is a form of spiritual worship through which a Muslim cleanses himself from the traces of sins and purifies his soul in a ceremony very similar to that of the Day of Judgment. If he or she performs Hajj perfectly and according to the Sunnah of the Prophet (peace and blessings be upon him) while devoting his act solely for Allah’s Sake, then he/she returns from Hajj as immaculate as he/she was on the day he/she was born.
The spirit of Hajj is turning to Allah wholeheartedly in humble and passionate yearning and ardent love and devotion. This spirit should rule the hearts of all pilgrims at all times. Pilgrims must refrain from all forms of intimate sexual contacts with spouses, including foreplay, kissing, and lustful touching; they also must shun all vain talks, wrangling and quarrels. However, a Muslim may commit sins and mistakes through Satan’s insinuations.
As regards masturbating during Hajj, it is subject to controversy among Muslim jurists. The majority of jurists hold that masturbation, whether done by hands or as a result of thoughts and looking with lust at someone, does not invalidate Hajj or `Umrah, but requires a sacrifice as an act of expiation. They maintain that masturbation is like kissing and caressing one’s wife without having intercourse, in which case Hajj is not rendered null and void.
However, the Maliki jurists are of the view that masturbation by hands invalidates Hajj and requires both sacrifice and making up for the Hajj later.
As for masturbation which is a result of deliberate and continuous thoughts and looking with lust at someone, it nullifies Hajj according to the Maliki jurists; but if it is resulted from an accident look or thought, it will not—according to the Maliki jurists—invalidate the Hajj but requires a sacrifice. In the view of the Hanafi, Shafi`i, and Hanbali jurists, masturbation which is a result of thoughts and lustful look doesn’t invalidate the Hajj. No sacrifice is required according to the Hanafi and Shafi` jurists. However, the Hanbali opinion maintains that sacrifice is required as a result of looking with lust at someone.
A good practicing Muslim should have good manners and exalt above the evil whims and Satanic insinuations. As soon as you put it in your mind that “you cannot control your desires”, you have undermined your determination to change your bad habits. You should better be positive and more inclined to do what pleases Allah and protects you from losing His love and pleasure. There are many ways to help you get rid of masturbation. Here are some of them:
1. Getting married as soon as possible, even with little furniture and humble accommodation.
2. Observing moderation in eating and drinking in order to avoid stimulating your desire.
3. Observing fasting, because it bolsters your faith, preserves chastity, and protects you from evil thoughts. The Prophet (peace and blessings be upon him) is reported to have said: “O youth, whoever of you is able to marry, let him marry, for it spares one looking at what one should not, or lapsing in adultery. And if he cannot marry, let him observe fasting, for it is a shield against evil.” (Reported by Muslim)
4. Keeping away from anything that is sexually stimulating, such as pornographic pictures, erotic films and love songs.
5. Choosing good and righteous friends.
6. Keeping yourself busy in worship and spiritual acts.
7. Interacting with beneficial activities of the society in such away that it keeps you away from thinking about sex.
8. Avoiding gatherings and places that bring men and women physically close to each other.
9. Trying to admire natural things such as flowers and beautiful scenery, which do not stimulate one sexually, instead of admiring girls and women.