It is narrated from Sayyiduna Uwaym bin Sa'idah al-Ansari (may Allah be pleased with him) that the Prophet (peace and blessings be upon him) came to them in the Masjid of Quba' and said: "Allah, the Mighty and Majestic, has praised you greatly for purification in connection with your masjid. What is this purification by which you purify yourselves?" They said: "O Messenger of Allah! We know of nothing, except that we had some Jewish neighbours who used to wash their backsides after relieving themselves, so we began washing just as they washed."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 14420