Sayyiduna Anas bin Malik (may Allah be pleased with him) said: A Bedouin came into the mosque and began to urinate there. The Companions of the Prophet (peace and blessings be upon him) tried to stop him, but he (peace and blessings be upon him) forbade them to stop him. When he had finished, the Prophet (peace and blessings be upon him) called him and said: "These mosques are not made for excrement, urine and filth; they are made only for the recitation of the Qur'an and the remembrance of Allah." Then he (peace and blessings be upon him) ordered one of the Companions, who brought a bucket of water, and he (peace and blessings be upon him) poured the water over it.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 4143