صحيح البخاري Sahih Bukhari كتاب الأحكام The Book of Al-Ahkam (Judgements)
بَابُ مَنْ حَكَمَ فِي الْمَسْجِدِ حَتَّى إِذَا أَتَى عَلَى حَدٍّ أَمَرَ أَنْ يُخْرَجَ مِنَ الْمَسْجِدِ فَيُقَامَ:

(19) Chapter. Whoever passed a judgement in the mosque and when the actual legal punishement was to be put to action,he ordered the guilty person to be taken outside the mosque so that the punishment might be carried out.

2 hadith
Hadith 7167
حَدَّثَنَا يَحْيَى بْنُ بُكَيْرٍ ، حَدَّثَنِي اللَّيْثُ ، عَنْ عُقَيْلٍ ، عَنِ ابْنِ شِهَابٍ ، عَنْ أَبِي سَلَمَةَ ، وَسَعِيدِ بْنِ الْمُسَيِّبِ ، عَنْ أَبِي هُرَيْرَةَ ، قَالَ : " أَتَى رَجُلٌ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ وَهُوَ فِي الْمَسْجِدِ ، فَنَادَاهُ ، فَقَالَ : يَا رَسُولَ اللَّهِ ، إِنِّي زَنَيْتُ ، فَأَعْرَضَ عَنْهُ ، فَلَمَّا شَهِدَ عَلَى نَفْسِهِ أَرْبَعًا ، قَالَ :أَبِكَ جُنُونٌ ، قَالَ : لَا ، قَالَ : اذْهَبُوا بِهِ فَارْجُمُوهُ " .
Narrated Abu Huraira: A man came to Allah's Apostle while he was in the mosque, and called him, saying, "O Allah's Apostle! I have committed illegal sexual intercourse." The Prophet turned his face to the other side, but when the man gave four witnesses against himself, the Prophet said to him, "Are you mad?" The man said, "No." So the Prophet said (to his companions), "Take him away and stone him to death. "
Hadith Reference Sahih Bukhari / The Book of Al-Ahkam (Judgements) / Hadith: 7167
Hadith Grading محدثین: أحاديث صحيح البخاريّ كلّها صحيحة
Hadith 7168
قَالَ ابْنُ شِهَابٍ : فَأَخْبَرَنِي مَنْ سَمِعَ جَابِرَ بْنَ عَبْدِ اللَّهِ ، قَالَ ، كُنْتُ فِيمَنْ رَجَمَهُ بِالْمُصَلَّى ، رَوَاهُ يُونُسُ ، وَمَعْمَرٌ ، وَابْنُ جُرَيْجٍ ، عَنِ الزُّهْرِيِّ ، عَنْ أَبِي سَلَمَةَ ، عَنْ جَابِرٍ ، عَنِ النَّبِيِّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ فِي الرَّجْمِ .
(continued from above)Narrated Jabir bin Abdullah: I was one of those who stoned him at the Musalla in Al-Madina (See Hadith 5272).
Hadith Reference Sahih Bukhari / The Book of Al-Ahkam (Judgements) / Hadith: 7168
Hadith Grading محدثین: أحاديث صحيح البخاريّ كلّها صحيحة