Praise be to Allah.
Firstly: You have to repent to Allaah from the secret habit and give it up, and beware of the consequences of sinning repeatedly, because the Prophet (peace and blessings of Allaah be upon him) said: “If a person commits a sin, a black spot appears on his heart. If he stops and seeks forgiveness and repents, his heart is cleansed, but if he goes back to it, it increases until it covers his entire heart. This is the raan which Allaah mentions (interpretation of the meaning): ‘Nay! But on their hearts is the Raan (covering of sins and evil deeds) which they used to earn’ [al-Mutaffifeen 83:14].” Narrated by al-Bukhaari, 3257; Ibn Maajah, 4234; classed as hasan by al-Albaani in Saheeh al-Tirmidhi, no. 2654. Please see also question no. 329, where there is an explanation of how to give up this bad habit.
Secondly: If a person does ghusl after having a wet dream or intercourse, then something comes out of him after that, unaccompanied by feelings of desire, he does not have to do ghusl again. . Ibn Qudaamah (may Allaah have mercy on him) said: If a person has a wet dream or has intercourse, and ejaculates, then he does ghusl, then some semen comes out of him, the well-known view narrated from Ahmad is that he does not have to do ghusl again. Al-Khallaal said: there are many reports from Abu ‘Abd-Allaah – i.e., Imam Ahmad – that say that all he has to do is wudoo’, whether he urinated or not, and this is the view that he settled on. This was also narrated from ‘Ali, Ibn ‘Abbaas, ‘Ata’, al-Zuhri, Maalik, al-Layth, al-Thawri and Ishaaq. Sa’eed ibn Jubayr said: He does not have to do ghusl unless that was accompanied by feelings of desire.
There is also another opinion, which is that it does not matter if that happened after urinating, and he does not have to do ghusl in that case, but if it happened before urinating, then he does have to do ghusl. This is the view of al-Awzaa’i and Abu Haneefah, and was also narrated from al-Hasan. That is because this is the left overs of what was emitted as a result of desire, so ghusl is required as it was in the first instance. But after urinating, it comes out without gushing and with no feelings of desire, and we cannot be sure that it is something left over from the first instance, because if it were something left over then it would not have stayed after urinating.
Al-Qaadi said: there is also a third opinion, which is that he has to do ghusl in either case. This is the view of al-Shaafa’i, because what matters is that it has come out, as in the case of all the things that nullify purity. He said elsewhere: he does not have to do ghusl, because the janaabah is one and the same so there is no need for two ghusls. It is as if it all came out in one go… From al-Mughni, 1/128.
The correct view is that if it comes out with no feelings of desire, then ghusl is not required, as it says in al-Insaaf, 1/232; and in Kashshaaf al-Qinaa’, 1/141, where it says “If semen comes out after doing ghusl then ghusl is not required. Or if semen comes out “after doing ghusl following intercourse in which he did not ejaculate”, with no feelings of desire, then no ghusl is required; and if the remaining semen comes out with no feelings of desire he does not have to do ghusl, because of the report narrated from Ibn ‘Abbaas, that he was asked about something coming out of a person after he had done ghusl from janaabah. He said: “Let him do wudoo’.” Something similar was narrated by Imam Ahmad from ‘Ali. And because this is one emission of semen so only one ghusl is required, as if it all came out in one go. And because it came out with no feelings of desire, as in the case when it is emitted because of cold. This is the reason that Ahmad gave; he said: because the desire is past, and rather it is a nullification of purity and I hope that wudoo’ will be sufficient.
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) said: The words “if something comes out after that, he does not have to do (ghusl) again” mean: if he does ghusl for this emission of semen, then some more comes out when he starts to move about, then he does not have to repeat ghusl. The evidence for that is as follows:
1 – The reason is one and the same, so two ghusls are not required.
2 – When it comes out after that, it is not accompanied by feelings of pleasure. And ghusl is only required if it comes out with feelings of pleasure.
But if semen is emitted anew with feelings of desire, then ghusl is required as a result of this new reason.
From al-Sharh al-Mumti’, 1/281. See also question no. 12352.
Thirdly: What is prescribed when doing ghusl from janaabah is to remove whatever of semen etc has contaminated the body, then to start to do ghusl beginning with the parts of the body that are washed in wudoo’, then pouring water over the rest of the body, because this is proven in the description of the ghusl of the Prophet (peace and blessings of Allaah be upon him). Al-Bukhaari (251) and Muslim (476) narrated that Maymoonah (may Allaah be pleased with her) said: I prepared water for the Prophet (peace and blessings of Allaah be upon him) for ghusl. He pour water with his right hand onto his left and washed them (his hands), then he washed his private part, then he wiped his hand on the ground, then he washed it. Then he rinsed his mouth and nose, then he washed his face, and poured water on his head. Then he shifted position and washed his feet. Then he was brought a cloth but he did not use it.”
If you remove some impurity etc that does not invalidate ghusl because what is required in ghusl is to wash the entire body with water – as well as rinsing the mouth and nose, according to the correct opinion – with the intention of doing ghusl. It is not a condition of removing impurity that one should avoid touching impurity whilst doing so.
And Allaah knows best.