One who becomes Junub due to sexual dream has to leave the Masjid

A: All praise be to Allah Alone, and peace and blessings be upon His Messenger, and his family and Companions. In case one discharges Maniy out of sexual excitement, he should leave the Masjid, if it takes place while inside it, and then take a Ghusl (ritual bath) to cleanse himself from Janabah (major ritual impurity related to sexual discharge). However, in case Maniy is discharged not due to sexual excitement, neither leaving the Masjid nor taking a Ghusl is required. This person will have to perform Wudu’ (ablution) at the time of every Salah (prayer) after performing Istinja’ (cleansing the private parts with water) and to protect the Masjid from being contaminated by the fluid he discharges while in it.