Sahih Muslim Book 2, Hadith Number 559.

Chapter : It is obligatory to cleanse the mosque when there are impurities in it and the earth becomes clean of impurities with the help of water without scraping (the part of it).

Anas b. Malik reported: While we were in the mosque with Allah’s Messenger (may peace be upon him), a desert Arab came and stood up and began to urinate in the mosque. The Companions of Allah’s Messenger (may peace be upon him) said: Stop, stop, but the Messenger of Allah (may peace be upon him) said: Don’t interrupt him; leave him alone. They left him alone, and when he finished urinating, Allah’s Messenger (may peace be upon him) called him and said to him: These mosques are not the places meant for urine and filth, but are only for the remembrance of Allah, prayer and the recitation of the Qur’an, or Allah’s Messenger said something like that. He (the narrator) said that he (the Holy Prophet) then gave orders to one of the people who brought a bucket of water and poured It over.