Mosques and places of Prayer - Section 2 Mishkat al-Masabih 734, 735
Arabic hadith text
وَعَنْ حَكِيمِ بْنِ حِزَامٍ قَالَ: نَهَى رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ أَنْ يُسْتَقَادَ فِي الْمَسْجِدِ وَأَنْ يُنْشَدَ فِيهِ الْأَشْعَارُ وَأَنْ تُقَامَ فِيهِ الْحُدُودُ. رَوَاهُ أَبُو دَاوُدَ فِي سُنَنِهِ وَصَاحِبُ جَامِعِ الْأُصُولِ فِيهِ عَنْ حَكِيمٍ
وَفِي المصابيح عَن جَابر
Translation
Hakim b. Hizam said that God's Messenger prohibited retaliation being taken in a mosque, the recitation of poems in it, and the infliction of punishment in it. Abu Dawud in his Sunan and the author of Jami‘ al-usul ( Ibn al-Athir) in his work transmitted it from Hakim, but in al-Masabih it is transmitted from Jabir.