the Messenger of Allah (ﷺ) forbade lashing for the legal punishment in the mosques.
Sunan Ibn Majah Book 20, Hadith 68