Sayyiduna Anas bin Malik (may Allah be pleased with him) said: A Bedouin urinated in the mosque, and the Companions of the Prophet (peace and blessings be upon him) (may Allah be pleased with them) said: Stop, stop! The Prophet (peace and blessings be upon him) said: "Do not interrupt his urination." The narrator said: When he had finished, the Prophet (peace and blessings be upon him) called him and said: "Mosques were not made for this, that is, for urine, excrement and filth. Rather, they are made for the recitation of the Qur'an and the remembrance of Allah." Then he (peace and blessings be upon him) ordered the Companions (may Allah be pleased with them), and they brought a bucket of water, and he (peace and blessings be upon him) poured it over it.
(b) In the hadith of Ikrimah bin Ammar: "They are made for the remembrance of Allah, prayer and the recitation of the Qur'an."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب آداب القاضي / 20264