Is a person in a state of major ritual impurity (Junuub) permitted to remain in the mosque?
Chapter on the Obligation of Purification
Al-Mughni
Book of Purification
Primary text
Remaining in the mosque is prohibited for a person in a state of major ritual impurity (Junub). This is based on the statement of Allah the Exalted: "...and not those in a state of major impurity except as travelers until they perform Ghusl" (Quran 4:43). Furthermore, the Prophet (peace be upon him) commanded the owners of houses opening into the mosque to direct them away from the mosque, stating, "I do not permit the mosque to a menstruating woman or one in a state of major impurity." This narration is recorded by Abu Dawud. The ruling is that remaining is forbidden except for the explicit allowance of passing through.
Supporting text
Passing through (crossing) the mosque is permissible out of necessity, such as fetching or leaving something, or if the path requires it. Those who permitted crossing include Ibn Mas'ud, Ibn Abbas, Ibn al-Musayyib, Ibn Jubayr, Al-Hasan, Malik, and Al-Shafi'i. Ath-Thawri and Ishaq permitted passing only if there is no alternative, requiring Tayammum (dry ablution) first.