He committed the secret habit during the nights of Mina when on Hajj
It is astonishing to hear of pilgrims who have left their homes and families and come, body and soul, to perform the rituals which Allaah has made one of the pillars of Islam, then one of them disobeys his Lord, and where? In the holy places, in the sanctuary! In Mina, which is within the boundaries of the Haram. We have already stated in the answer to question no. 329 that the secret habit is haraam, and undoubtedly a sin becomes more serious if it is committed at a time or in a place that is regarded as holy, which is what has happened in this case, where it was done in the sanctuary during a time that is venerated, namely the Ayaam al-tashreeq, the days of the rituals and of remembering Allaah.
Committing sin during Hajj diminishes its reward. The scholars said concerning the accepted Hajj: it is that in which there is no sin. This is indicated by the words of the Prophet (peace and blessings of Allaah be upon him): “Whoever performs Hajj and does not utter obscene speech or commit immoral actions will go back (free of sin) as on the day his mother bore him.” Narrated by al-Bukhaari, 1521; Muslim, 1350.
The person asked about here has to repent to Allaah and seek forgiveness. He has to sincerely regret what he did, and resolve not to go back to that sin. He also has to do a lot of acts of worship and pray to Allaah to accept them from him.
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) said:
Sin in general detracts from the reward of Hajj, because Allaah says (interpretation of the meaning):
“So whosoever intends to perform Hajj therein (by assuming Ihraam), then he should not have sexual relations (with his wife), nor commit sin, nor dispute unjustly during the Hajj”
Some of the scholars said: Sin during Hajj invalidates the Hajj, because it is forbidden during Hajj. But the majority of the scholars follow their well-known principle that if a prohibition is not connected to a specific act of worship then it does not invalidate it. Sins are not connected specifically to ihraam, rather sins are forbidden whether one is in ihraam or not. This is the correct view. These sins do not invalidate the Hajj but they do detract from it.
Fataawa Arkaan al-Islam, p. 571
Shaykh ‘Abd al-‘Azeez ibn Baaz (may Allaah have mercy on him) was asked about a man who committed the secret habit after entering ihraam for Hajj and before going to ‘Arafat. He replied:
Your Hajj is valid according to the more correct of the two scholarly views, but you have to repent to Allaah from that, because the secret habit is haraam for both pilgrims and others, because Allaah says (interpretation of the meaning):
“And those who guard their chastity (i.e. private parts, from illegal sexual acts)
6. Except from their wives or (the slaves) that their right hands possess, for then, they are free from blame;
7. But whoever seeks beyond that, then those are the transgressors”
And because it causes a great deal of harm as the scholars have explained. We ask Allaah to guide us and you. You also have to offer a sacrifice in Makkah, the meat of which should be given to the poor.
Majmoo’ Fataawa wa Maqaalaat Mutanawwi’ah, 17/138.
And Allaah knows best.