Does Masturbation Invalidate Hajj?
Question

I went for hajj with my father when I was fifteen years old, and that was fourteen years ago. After we entered ihram at Abyar ‘Ali, and got in the car, I engaged in the secret habit without intending to emit maniy, but things got out of hand without me wanting to and I emitted maniy. Because I was aware that emission of maniy invalidates ihram, which is one of the conditions of Hajj being sound, and because I did not tell my father what had happened, I kept that to myself and I thought that my hajj was invalid. I said to myself that I would repeat it the following year, if Allah willed, and I did not intend to complete hajj. Because I was young, I did some of the essential parts and obligatory acts of hajj without forming the intention, as my father was doing them and I was doing them with him, without forming the intention. If my father was not with me, I did not even complete tawaaf or sa‘i, thinking that my hajj was invalid and that I had to repeat it. That was only because of my lack of knowledge, as I was very young. Now I do not remember whether we said the phrase “If something prevents me from continuing, then my exiting ihram will be at the place where You caused me to be prevented from continuing” when we entered ihram, although I think it most likely that we said it, because my father is knowledgeable and I do not think that he did not prompt me to say it, but a long time has passed since these events occurred. After we shaved our heads and stoned the Jamrah on the Day of Sacrifice (we were doing Hajj ifrad, i.e., Hajj on its own without `umrah ), we exited our ihram. We returned home after completing the rituals, and I have not been able until today to do the obligatory hajj, although I did `umrah several times after that. Please note that I am over twenty-eight years old. 
My question is: Is it true that I am regarded as still being in ihram since that time, and that I must offer expiation for all the things that I have done that are forbidden whilst in ihram during that period? What is the ruling on the `umrah s that I did after that Hajj? Seeing that I have done the marriage contract, but have not yet consummated the marriage with my wife, is it true that the marriage contract is invalid, because I am still in ihram? 
I hope that you can advise me about the above, on the basis of what I have told you. May Allah reward you with good.
Praise be to Allah.Does masturbation invalidate hajj?
Masturbation is haram during Hajj and otherwise, but during ihram it is worse and more serious, although it does not mean that hajj is rendered invalid according to the majority of jurists, with the exception of the Malikis.
According to the majority, a compensatory sacrifice is required for that, which is a camel according to the Hanbalis. However, according to the view that it renders Hajj invalid, it is still obligatory to continue with it, and also make it up the following year. (See: al-Mawsu’ah al-Fiqhiyyah, 2/193) and al-Insaf , 3/224)
The correct view is that of the majority, which is that masturbation does not render hajj invalid , because there is no evidence to suggest that it does so, and because the analogy comparing masturbation to intercourse is weak.
Masturbated in hajj: Should I complete the rituals?
You made a much more serious mistake by not completing your Hajj, even according to the view that it was rendered invalid, because it was still obligatory to complete it. If you did not complete it, then you are still in a state of ihram, according to both views.
Ad-Dardir said in ash-Sharh al-Kabir ma‘a ad-Dasuqi (2/68): 
“It is haram for both spouses to have intercourse or do the things that lead to it… Having intercourse renders Hajj and `umrah invalid in all cases , regardless of whether it was done by mistake or he forced her, and whether he did any of the actions of Hajj after entering ihram or not, and whether he had reached the age of puberty or not, such as doing anything that leads to the emission of maniy. It is haram and renders Hajj invalid if emitted.”
Then he said:
“It is still obligatory – with no difference of opinion among the scholars concerning that except Dawud – for the one who has rendered it invalid to complete that Hajj or `umrah , so he should continue with it, like a valid Hajj, if he manages to stand in `Arafah. But if he cannot stand in `Arafah due to some obstacle or impediment, then he must exit ihram by doing `umrah , and it is not permissible for him to remain in ihram until the following year, because by doing that he is persisting in a Hajj that is invalid when he is able to extricate himself from it. If he could not complete his Hajj, whether he thought it was permissible to interrupt it or not, then he is still in a state of ihram, even if he renewed his ihram with the intention of making up (for that invalidated Hajj) or not, and that second ihram does not count for anything. As he is still in a state of ihram for the first Hajj, and he entered ihram the following year to make up for that Hajj, that cannot make up for the invalidated Hajj, and whatever he does the following year is to be regarded as completing the invalidated Hajj; making it up cannot be done until the third occasion, if it was `umrah , or the third year if it was Hajj.”
It says in ash-Sharh as-Saghir ma‘a as-Sawi (2/95):
“The one who invalidated his Hajj by having intercourse or ejaculating – whether he thought it was permissible to interrupt it because it had been spoiled or not – remains in a state of ihram for as long as he lives.”
Validity of rituals done while in a state of ihram because of not completing hajj
Based on the view of the majority, your Hajj was not invalidated by masturbating, and you should have completed it. If you did not do tawaf al-ifadah, or the sa`i of Hajj, or you did not intend to do one of them, then you are still in a state of ihram and your doing `umrah did not free you from ihram; rather this `umrah does not count, according to the majority of scholars, or you may be regarded as doing qiran because you incorporated it with Hajj, as is the view of the Hanafis. (See: al-Mawsu‘ah al-Fiqhiyyah (2/140); ash-Sharh al-Mumti‘ (7/86)
You must go to Makkah and do tawaf and sa`i, and thus you will exit ihram of Hajj.
If you had stoned the Jamarat without forming the intention, then you must offer a compensatory sacrifice for that, because stoning the Jamarat without forming the intention comes under the same ruling as not doing it at all.
A marriage contract done whilst still in a state of ihram is not valid, so it must be redone after exiting ihram.
What you did during this period of actions that are forbidden whilst in ihram is overlooked, regardless of whether you had completed the first stage of exiting ihram or not; you are excused because you were unaware of the ruling.
Not remembering a condition when entering ihram: does it count?
With regard to what you mention about stipulating a condition when entering ihram [that if some impediment prevented you from continuing and completing Hajj, you would exit ihram at that point with no penalty], if you are not certain that you said it, it does not count, because the basic principle is that the condition was not stipulated, unless you remember that you did it.
Rather what appears to be the case is that stipulating a condition is of no benefit in this instance, because there was no impediment that prevented you from completing the rituals.
What you must do is repent to Allah, may He be exalted, from what you have done and from your heedlessness in not asking and finding out what you needed to know about your acts of worship.
We ask Allah to accept from us and from you.
And Allah knows best.