Ibn Khuzaymah bin Thabit narrates from his father, who said: The Messenger of Allah (peace and blessings be upon him) said: "Whoever has had a prescribed punishment carried out upon him (i.e., he has been punished for a crime), then that sin is forgiven for him." (That is, a person upon whom the prescribed punishment has been carried out becomes purified from that sin.)
Hadith Referenceسنن دارمي / من كتاب الاحدود / 2368
Hadith Gradingتحقیق (حسین سلیم أسد الدارانی):إسناده حسن من أجل أسامة بن زيد وهو: الليثي، [مكتبه الشامله نمبر: 2376]
Hadith Takhrijاس روایت کی سند حسن ہے۔ ابن خزیمہ کا نام: معاویہ ہے اور اسامہ بن زید لیثی ہیں، تخریج کے لئے دیکھئے: [طبراني 88/4، 3731، 3828] ، [التاريخ الكبير للبخاري 206] ، [أحمد 214/5] ، [ابن حبان 4405] ، [الحميدي 391]
Brief Explanation
(Commentary on Hadiths 2366 to 2368)
If someone is subjected to the prescribed punishment (hadd) or any other penalty for a major sin (kabirah), then according to the hadith, that serves as expiation (kaffarah) for his sin. Allah Ta’ala is Most Forgiving, Most Merciful; He will not subject him to punishment twice. However, the condition is that he must repent sincerely. And if such a criminal was not subjected to the prescribed punishment and died, then it depends on the will of Allah Ta’ala: if He wills, He may forgive and say, “Go, in the world I concealed your crime, now in the Hereafter I also forgive you,” or if He wills, He may subject him to punishment.
«﴿إِنْتُعَذِّبْهُمْفَإِنَّهُمْعِبَادُكَوَإِنْتَغْفِرْلَهُمْفَإِنَّكَأَنْتَالْعَزِيزُالْحَكِيمُ﴾ [المائده : 118]» “If You punish them, they are Your servants; and if You forgive them, then (O Lord) You are indeed the Mighty, the Wise.”