The Messenger of Allah ﷺ said, "Legal punishments are not to be carried out in mosques."
حدثنا سويد بن سعيد حدثنا علي بن مسهر ح و حدثنا الحسن بن عرفة حدثنا أبو حفص الأبار جميعا عن إسمعيل بن مسلم عن عمرو بن دينار عن طاوس
أن رسول الله ﷺ قال لا تقام الحدود في المساجد
No references are available.
[Its chain is daif]. Tirmidhi transmitted it in the Book of Blood Money, chapter on what has been reported about a man who kills his son, whether retaliation is exacted from him or not, hadith no. 1401, from the hadith of Ismail, with the same chain as before, hadith no. 301, and it is daif as stated in Talkhis Habir 4/77, hadith no. 1800, and elsewhere. It has a daif corroborating narration in Abu Dawud, hadith no. 4490, and Hafiz said, "There is no harm in its chain." The hadith has other routes, none of which is sound. See the following hadith.