If someone commits zina, steals or drinks alcohol, will his repentance and righteous deeds be accepted without the hadd punishment being carried out on him?
Question

If someone oversteps the limits set by Allah, by committing zina, reviling the religion and other grave sins, and the hadd punishment is not carried out on him, will his good deeds be accepted? Is the condition of acts of worship, righteous deeds, du‘aa’, prayer and so on being accepted connected to the hadd punishment being carried out on him, or if the hadd punishment is not carried out on him, will his acts of worship be valid?
Praise be to Allah.Firstly:
If someone commits any of the major sins such as zina, stealing, drinking alcohol or apostasy – Allah forbid – then what he must do is repent to Allah, may He be exalted, by giving up the sin, regretting it, resolving not to go back to it, and righting any wrongs done to people, if applicable.
When someone repents, Allah turns to him in mercy and accepts his repentance, no matter what his sins or crimes. No sin is too great for Allah, may He be exalted, to forgive.
Allah, may He be exalted, says (interpretation of the meaning):
“And those who do not invoke with Allah another deity or kill the soul which Allah has forbidden [to be killed], except by right, and do not commit unlawful sexual intercourse. And whoever should do that will meet a penalty.
Multiplied for him is the punishment on the Day of Resurrection, and he will abide therein humiliated –
Except for those who repent, believe and do righteous work. For them Allah will replace their evil deeds with good. And ever is Allah Forgiving and Merciful.”
[al-Furqaan 25:68-70].
Here Allah mentions shirk, murder and zina (unlawful sex), then He states that whoever repents, believes and does righteous deeds, Allah will turn to him in mercy and accept his repentance, and will turn his bad deeds into good deeds.
And Allah, may He be exalted, says (interpretation of the meaning):
“But indeed, I am the Perpetual Forgiver of whoever repents and believes and does righteousness and then continues in guidance”
[Taa-Haa 20:82].
Secondly:
The one who falls into sin and repents is not required to seek to have the hadd punishment carried out on him; rather what is more appropriate for him is to conceal his sins and repent, keeping the matter between him and his Lord, and to do a lot of righteous deeds, because the Prophet (blessings and peace of Allah be upon him) said: “Avoid these filthy things that Allah, may He be glorified and exalted, has forbidden. Whoever falls into any of them, let him conceal himself with the concealment of Allah, may He be glorified and exalted.” This hadith was narrated by al-Bayhaqi and classed as saheeh by al-Albaani in as-Silsilah as-Saheehah, no. 663.
Al-Bukhaari (4894) narrated that ‘Ubaadah ibn as-Saamit (may Allah be pleased with him) said: We were with the Prophet (blessings and peace of Allah be upon him) and he said:  “Will you swear allegiance to me, pledging that you will not associate anything with Allah, you will not commit zina, and you will not steal” – and he recited the verse from an-Nisa’ – “and whoever among you fulfils that, his reward will be with Allah. Whoever commits any of those actions and is punished, that will be an expiation for him; and whoever commits any of those actions and Allah conceals him (his sin), then it is up to Allah – if He wills He will punish him and if He wills He will forgive him.”
Muslim (2590) narrated from Abu Hurayrah that the Prophet (blessings and peace of Allah be upon him) said: “Allah does not conceal [the sin of] a person in this world but Allah will conceal him [his sin] on the Day of Resurrection.”
Ahmad (21891) narrated from Nu‘aym ibn Hazzaal that Hazzaal hired Maa‘iz ibn Maalik [to do some work for him]. He had a slave girl called Faatimah, who used to tend sheep for them.  Maa‘iz had intercourse with her, then he told Hazzaal and he said: Go to the Prophet (blessings and peace of Allah be upon him) and tell him; perhaps Qur’an will be revealed concerning you. But the Prophet (blessings and peace of Allah be upon him) ordered that he be stoned. When he felt the severe pain of the stones, he took off running and was met by a man appeared in front of him, holding the jawbone or shinbone of a camel; he struck him with it and killed him. The Prophet (blessings and peace of Allah be upon him) said: “Woe to you, O Hazzaal! If you had covered him with your garment, that would have been better for you.” The commentators on al-Musnad said: It is saheeh because of corroborating evidence.
In Saheeh Muslim (1695) it says that when Maa’iz came to the Prophet (blessings and peace of Allah be upon him) and admitted committing zina and said, Purify me [that is, by carrying out the hadd punishment], he said to him: “Woe to you, go back and seek forgiveness from Allah and repent to Him.”
An-Nawawi (may Allah have mercy on him) said: This hadith indicates that major sins are forgiven when one repents, according to the consensus of the Muslims. End quote.
Al-Haafiz Ibn Hajar (may Allah have mercy on him) said: From the case of Maa‘iz, when he admitted to committing zina, it may be understood that it is mustahabb (recommended) for the one who commits something like he did to repent to Allah, may He be exalted, and conceal himself [his sin], and not tell anyone about that…  This was stated definitively by ash-Shaafaa‘i (may Allah be pleased with him), who said: I prefer for the one who commits a sin and Allah conceals it to conceal himself and repent. End quote from Fath al-Baari (12/124).
It says in Mataalib Ooli an-Nuha (6/168): “Whoever commits a sin that incurs a hadd punishment should conceal himself [his sin], as this is mustahabb. It is not obligatory and is not Sunnah for him to admit to that before a judge, because of the hadith: “Verily Allah is Sitteer [that is, He conceals people’s sins] and He loves those of His slaves who conceal their sins.” End quote.
The scholars of the Permanent Committee said: If news of a sin that incurs a hadd punishment reaches the judge and is proven with sufficient evidence, then it is obligatory to carry out the hadd punishment and that punishment is not waived by repentance, according to scholarly consensus. The Ghaamidi woman came to the Prophet (blessings and peace of Allah be upon him), asking him to carry out the hadd punishment on her after she had repented, and he said concerning her: “She has repented so greatly that if the people of Madinah were to repent in that manner, it would suffice them.” Yet despite that, he carried out the prescribed hadd punishment on her, and that is not for anyone except the ruler (one in authority) to do.
But if news of the sin that incurs punishment does not reach the ruler, then the Muslim should conceal himself with the concealment of Allah, and repent sincerely to Allah, in the hope that Allah will accept it from him.
End quote from Fataawa al-Lajnah ad-Daa’imah (22/15).
Thirdly:
From the above, it is clear that it is better for a person to conceal himself than to seek to have the hadd punishment carried out on him. From this it is known that the hadd punishment is not a condition for repentance, and that repentance is valid without it. Hence it is more appropriate to say that other righteous deeds will be accepted without the hadd punishment being carried out, because there is no connection between them and the hadd punishment.
Conclusion:
If a person commits zina, for example, it is mustahabb (recommended) for him to conceal himself with the concealment of Allah, and to repent, keeping the matter between him and his Lord, and not to tell anyone of his sin. It is also mustahabb for anyone who comes to know of it to conceal it, and to urge him to conceal himself, for if he repents, Allah will turn to him in mercy and accept his repentance, and the fact that the hadd punishment was not carried out on him will not affect his repentance or any of his other good deeds.
And Allah knows best.