It wasnarrated that Abu Hurairah said:
"The Prophet (ﷺ) came outtopray and said the Takbir, then he gestured to them to wait. He wentand took a bath, and his head was dripping with water while he ledthem in prayer. When he finished he said: 'I came out to you in astate of sexual impurity, and I forgot until I had started to pray.'"
English reference: Vol. 1, Book 5, Hadith 1220
Arabic reference: Book 5, Hadith 1277
Read hadith from the major collections in the app, with prayer times and a Qibla compass. Free.