Anas ibn Malik reported: A man came to the Messenger of Allah, peace and blessings be upon him, and he said, “O Messenger of Allah, I have committed an offense, so impose punishment upon me.” The man was present at the prayer and he prayed with the Prophet. When they finished praying, the man repeated his request. The Prophet said, “Were you with us during the prayer?” The man said yes. The Prophet said, “You have been forgiven.”
Source: Ṣaḥīḥ al-Bukhārī 6823, Ṣaḥīḥ Muslim 2764
Grade: Muttafaqun Alayhi (authenticity agreed upon) according to Al-Bukhari and Muslim
عَنْ أَنَسٍ قَالَ جَاءَ رَجُلٌ إِلَى النَّبِيِّ صلى الله عليه وسلم فَقَالَ يَا رَسُولَ اللَّهِ أَصَبْتُ حَدًّا فَأَقِمْهُ عَلَىَّ قَالَ وَحَضَرَتِ الصَّلاَةُ فَصَلَّى مَعَ رَسُولِ اللَّهِ صلى الله عليه وسلم فَلَمَّا قَضَى الصَّلاَةَ قَالَ يَا رَسُولَ اللَّهِ إِنِّي أَصَبْتُ حَدًّا فَأَقِمْ فِيَّ كِتَابَ اللَّهِ قَالَ هَلْ حَضَرْتَ الصَّلاَةَ مَعَنَا قَالَ نَعَمْ قَالَ قَدْ غُفِرَ لَكَ
6823 صحيح البخاري كتاب الحدود باب إذا أقر بالحد ولم يبين هل للإمام أن يستر عليه
2764 صحيح مسلم كتاب التوبة