the ground beneath it. However, this reasoning is weak. The airspace follows the ground with respect to ownership, but not with respect to legal rulings. Prayer in a latrine was prohibited because of impurity; so if there is no impurity on its roof, there is nothing to prevent it. This is the correct view, adopted by the author of al-Mughnī (1).
The evidence that it is valid is the general import of the Prophet’s saying, may Allah’s peace and blessings be upon him: “The earth has been made for me a place of prostration and a means of purification.” (2) Accordingly, there is nothing wrong with praying atop a cesspit or a drain, for these are even less objectionable than the roof of a latrine. Regarding the roof of a latrine, someone might argue that it falls under the designation of a latrine, and that prayer upon it is therefore invalid. But the roof of a cesspit is not subsidiary to it; rather, it is independent. This is also the established practice of people, for cesspits and foul sewage pipes pass through courtyards, and people pray over them.
Third: the roof of a bathhouse. Prayer upon it is not valid. They reasoned that the airspace follows the ground beneath it, and that the roof of a bathhouse falls under the designation of a bathhouse.
The second view on this issue is that prayer on the roof of a bathhouse is valid (3). For if the reason concerning the bathhouse is that it is a dwelling place for devils, then devils only dwell in the place where private parts are exposed. And if the reason is the fear of impurity, then the roof is far removed from this concern. Accordingly, prayer on the roof of a bathhouse is valid.
Fourth: the roof of camel enclosures. Prayer upon it is not valid. They reasoned