Sayyiduna Miqdad (may Allah be pleased with him) said: Sayyiduna Ali (may Allah be pleased with him) said to me: Ask the Messenger of Allah (peace and blessings be upon him) about a man who fondles his wife and madhi (pre-seminal fluid) comes out of him. So I said: O Messenger of Allah! Tell me about a man who fondles his wife and madhi comes out of him. He (peace and blessings be upon him) said: "He should wash his private parts, and perform ablution like the ablution for prayer."
Hadith Referenceالمعجم الكبير للطبراني / باب الميم / 17698