Mishkat al-Masabih 492
وَعَن أنس قَالَ: بَيْنَمَا نَحْنُ فِي الْمَسْجِدِ مَعَ رَسُولِ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ إِذْ جَاءَ أَعْرَابِيٌّ فَقَامَ يَبُولُ فِي الْمَسْجِدِ فَقَالَ أَصْحَابُ رَسُولِ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ مَهْ مَه قَالَ فَقَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «لَا تَزْرِمُوهُ دَعُوهُ» فَتَرَكُوهُ حَتَّى بَالَ ثُمَّ إِنَّ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ دَعَاهُ فَقَالَ لَهُ: «إِنَّ هَذِهِ الْمَسَاجِدَ لَا تصلح لشَيْء من هَذَا الْبَوْل وَلَا القذر إِنَّمَا هِيَ لذكر الله عز وَجل وَالصَّلَاةِ وَقِرَاءَةِ الْقُرْآنِ» أَوْ كَمَا قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ قَالَ فَأمر رَجُلًا مِنَ الْقَوْمِ فَجَاءَ بِدَلْوٍ مِنْ مَاءٍ فسنه عَلَيْهِ
From Anas, who said: While we were in the mosque with the Messenger of Allah ﷺ, a bedouin came and stood urinating in the mosque. The Companions of the Messenger of Allah ﷺ said: "Stop! Stop!" He said: The Messenger of Allah ﷺ said: "Do not interrupt him; leave him." So they left him until he had urinated. Then the Messenger of Allah ﷺ called him and said to him: "These mosques are not suitable for anything of this urine or filth; they are only for the remembrance of Allah, Mighty and Majestic, salah and the recitation of the Quran," or as the Messenger of Allah ﷺ said. He said: Then he commanded a man from the people, and he brought a bucket of water and poured it over it.