Is masturbation allowed in Islam if it’s done to avoid a major sin?

Assalamalekum. Me and my cousin lives in the same house with my parents. After watching her my feelings arouses and there is always a chance of major sin. To keep myself cool use to masturbate. Does masturbation allowed in Islam under this condition?

Answer:

(Fatwa: 1169/1011=L/1429)

It is unlawful to masturbate in this case also. But, if sometime both of you are in privacy with no obstacle in committing adultery and you masturbate in this condition then you may be excused.

Allah (Subhana Wa Ta’ala) knows Best

Darul Ifta,
Darul Uloom Deoband

This answer was collected from the official ifta website of Darul Uloom Deoband in India.

Link