Praise be to Allah.
Madhiy is something impure (najis) from which we must purify ourselves.
Ibn ‘Abd al-Barr (may Allah have mercy on him) said:
The regular, well-known substance of madhiy is a matter concerning which there is consensus and no difference of opinion among the Muslims that it is obligatory to do wudu because of it, and it is obligatory to wash it off because it is impure (najis).
End quote from at-Tamhid (21/207).
So if it is emitted and any of it gets onto the body, it is obligatory to wash the place it got onto. If someone prays knowing that there is any madhiy on his body and he deliberately did not wash it, then his prayer is not valid.
For the ruling on prayer offered when the body or clothes are not pure (tahir), please see the answers to questions no. 12720 and 195117.
If the madhiy gets onto the testicles, then they must be washed in order to remove this impurity, as stated above.
But if the madhiy did not get onto them, and it did not go beyond the place where it was emitted, then in this case there is a difference of opinion among the scholars: is it sufficient to wash only the area of the penis where it was emitted, or must the entire penis, along with the testicles, be washed?
The view of Imam Ahmad is that both the penis and the testicles must be washed.
Al-Mirdawi (may Allah have mercy on him) said:
Based on the view that it is impure (najis), the penis and testicles must be washed if it is emitted, according to the correct view.
End quote from al-Insaf (2/328-329).
He quoted as evidence for that the report narrated in as-Sahihayn from ‘Ali (may Allah be pleased with him), according to which the Prophet (blessings and peace of Allah be upon him) enjoined washing the private part; the apparent meaning indicates that what is meant is the entire private part. In books other than as-Sahihayn – such as Musnad Ahmad etc. – it is narrated that it is enjoined to wash the testicles.
It was narrated that ‘Ali (may Allah be pleased with him) said: I was a man who emitted a great deal of madhiy, so I told a man to ask the Prophet (blessings and peace of Allah be upon him) about that, because of the position of his daughter. He said: “Do wudu and wash your private part.” Al-Bukhari (269) and Muslim (303).
The apparent meaning of the word is that the entire private part is to be washed; however, the majority of scholars said that what is meant by “private part” here is the place where the madhiy is emitted, and not the entire private part. They supported that by comparing it to all other types of impurities; in all other cases it is only required to wash the place where the impurity is.
Ibn Daqiq al-‘Id (may Allah have mercy on him) said:
The scholars differed as to whether he should wash the entire private part, or only the place where the impurity is. The majority are of the view that washing may be limited to the place where the impurity is…
End quote from Ihkam al-Ahkam (1/74).
An-Nawawi (may Allah have mercy on him) said:
What is required is to wash only the place where the impurity is. This is our view and the view of the majority.
End quote from al-Majmu‘ (2/144).
Ibn Rajab (may Allah have mercy on him) said:
The scholars differed concerning what is meant by the command to wash the private part in the case of madhiy. Does it mean to wash only the area of the private part where the madhiy got onto it – as is the case with urine – or to wash the entire private part?
There are two views concerning that, both of which were narrated from Malik and Imam Ahmad.
End quote from Fath al-Bari (1/304).
Ibn Daqiq al-‘Id (may Allah have mercy on him) said:
The majority of scholars chose not to interpret the word “private part” as referring to the entire area; rather they focused on the context, as what makes washing obligatory is the emission of the substance, which dictates that one may limit washing to the place from which it was emitted and the place it got to [on the body or clothes].
End quote from Ihkam al-Ahkam (1/74).
Abu Ja‘far at-Tahhawi (may Allah have mercy on him) said:
In support of the view that only the place of emission and the place it got to [on the body or clothes] is to washed, we may say by analogy that the emission of madhiy is an emission of something that invalidates wudu; as in the case of urination and defecation, all that is required is to wash the place from which it was emitted and the place it got to [on the body or clothes], and there is no need to wash any more than that, unless one wants to do wudu and pray. The same applies with regard to bleeding from any part of the body, according to the view of those scholars who regard bleeding as invalidating wudu.
This is the way in which emission of madhiy is to be dealt with. As emission of madhiy is something that invalidates wudu, it does not require any washing apart from washing it from wherever it got on the body, and apart from washing in order to purify oneself for prayer (wudu). Thus this argument is further supported by reasoning.
This is the view of Abu Hanifah, Abu Yusuf, and Muhammad ibn al-Hasan (may Allah have mercy on them).
End quote from Sharh Ma‘ani al-Athar (1/48).
Those who say that it is impure (najis) responded to that by noting that there is nothing to prevent suggesting that washing more than the place where it is emitted is required. There is a similar case to that in Islamic teaching, which is that it is obligatory to wash the entire body when maniy is emitted. They also mentioned a benefit of that, which is that washing the penis and testicles stops the emission of madhiy.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said:
And because it is emitted as a result of desire, therefore it is reasonable to suggest that it is obligatory to wash more than the place where it is emitted, as in the case of maniy. That is because the testicles are its vessel, so washing them will put a stop to it.
End quote from Sharh al-‘Umdah (1/103).
It was narrated by Imam Ahmad in al-Musnad (2/293), and by Abu Dawud (208), from Hisham ibn ‘Urwah, from ‘Urwah, than ‘Ali ibn Abi Talib said to al-Miqdad … and he mentioned a similar report and said: So al-Miqdad asked him, and the Messenger of Allah (blessings and peace of Allah be upon him) said: “Let him wash his penis and testicles.”
Al-Hafiz Ibn Hajar said in at-Talkhis al-Tahbir (1/117):
It was narrated by Abu Dawud via ‘Urwah from ‘Ali, and in it it says: “Let him wash his testicles and his penis.” ‘Urwah did not hear [directly] from ‘Ali, but Abu ‘Awanah narrated in his Sahih from ‘Ubaydah from ‘Ali with some additional material, and there is nothing wrong with its isnad. End quote.
As-San‘ani said in Subul as-Salam (1/199):
As it is sahih (sound), there is no reason not to accept the ruling based on it. End quote.
Abu Dawud (211) narrated from al-‘Ala ibn al-Harith, from Haram ibn Hakim, from his paternal uncle ‘Abdullah ibn Sa‘d al-Ansari, who said: I asked the Messenger of Allah (blessings and peace of Allah be upon him) about what necessitates ghusl and about water [madhiy] that is emitted after water [maniy]. He said: “That is madhiy, and every male emits madhiy. So wash it from your private part and your testicles, then do wudu as for prayer.” (1/207). Classed as sahih by Shaykh al-Albani (may Allah have mercy on him) in Sahih Sunan Abi Dawud (1/381).
Shaykh Ibn Baz (may Allah have mercy on him) said:
What is required in the case of madhiy is to wash the penis and testicles.
End quote from Fatawa ash-Shaykh Ibn Baz (17/58).
The scholars of the Permanent Committee for Ifta said:
… With regard to madhiy, it is impure (najis). If you emit madhiy, you must wash the penis from its base, and the testicles, and sprinkle water over whatever parts of the clothes and body the madhiy got onto, because the Prophet (blessings and peace of Allah be upon him) instructed ‘Ali to wash his penis and testicles and do wudu in the case of madhiy, and he instructed him to sprinkle water over whatever of it got onto his clothes.
And Allah is the source of strength. May Allah send blessings and peace upon our Prophet Muhammad and his family and Companions.
Permanent Committee for Academic Research and Ifta
‘Abdullah ibn Qa‘ud, ‘Abdullah ibn Ghadyyan, ‘Abd ar-Razzaq ‘Afifi, ‘Abd al-‘Aziz ibn ‘Abdillah ibn Baz.
End quote from Fatawa al-Lajnah ad-Daimah (5/382).
Shaykh Ibn ‘Uthaymin (may Allah have mercy on him) was asked:
What is the correct view with regard to washing the penis and testicles when madhiy is emitted?
The correct view is that it is obligatory, and there is a medical benefit in doing that, which is that washing the penis and testicles stops the emission of madhiy.
End quote from Ta‘liqat ash-Shaykh Ibn ‘Uthaymin ‘ala al-Kafi.
So the correct view is that it is obligatory to wash the penis and testicles when madhiy is emitted, because of the soundness of the hadith which enjoins that.
With regard to the validity of prayer, with regard to such matters which are subject to ijtihad, there is no blame on the one who follows one of the two scholarly views, so long as he believes that it is the correct view, or he is following a scholar whose view it is.
Please see also the answers to questions no. 180032 and 234599.
And Allah knows best.