Anas bin Malik reported,

While we were in the mosque with the Messenger of Allah ﷺ, a Bedouin came in and began to urinate inside the mosque. The companions of the Messenger of Allah called out, "Stop! Stop!"The Messenger of Allah ﷺ said, "Do not interrupt him. Leave him alone."So they left him until he finished. Then the Messenger of Allah ﷺ called him over and said to him, "These mosques are not suitable for any of this urine or filth. They are only for the remembrance of Allah عز وجل, prayer, and the recitation of the Quran," or words to that effect from the Messenger of Allah ﷺ.Then he ordered one of the men present to bring a bucket of water, which he poured over the spot.

Azami 12888

Sahih

عن أنس بن مالك قال

بينما نحن في المسجد مع رسول الله ﷺ إذ جاء أعرابي، فقام يبول في المسجد، فقال أصحاب رسول الله: مه مه. قال: قال رسول الله ﷺ: لا تزرموه، دعوه فتركوه حتى بال، ثم إن رسول الله ﷺ دعاه، فقال له: إن هذه المساجد لا تصلح لشيء من هذا البول ولا القذر، إنما هي لذكر الله عز وجل والصلاة وقراءة القرآن أو كما قال رسول الله ﷺ قال: فأمر رجلا من القوم، فجاء بدلو من ماء، فشنه عليه.

الأعظمي 12888صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Tafsir of the great Quran
Chapter
Tafsir of Surah Nur
Section
His saying, "In houses which Allah has ordered to be raised and in which His name is remembered. Therein glorify Him in the mornings and the evenings men whom neither trade nor sale diverts from the remembrance of Allah and the establishment of prayer and the giving of zakat. They fear a day in which the hearts will be overturned."
Numbering
Jami al-Kamil 12888 (2nd edition)
Azami 12888