But if the deceased is brought to the graveyard and the funeral prayer is offered over him before burial, what is the ruling?
The answer is that we have the general statement: “The entire earth has been made a place of prayer, except for graveyards and bathrooms” (1). The prayer over the deceased is undoubtedly a prayer. This is why it begins with takbīr and ends with taslīm, and ritual purity and recitation are required for it. It is therefore a prayer, so what excludes it from the general import of his saying, “except for graveyards”? Yet it may be permissible for us to draw an analogy between it and praying over the grave. Since it is established that the Messenger of Allah (peace and blessings be upon him) prayed over a grave, there is no difference between praying over a buried funeral bier and praying over one that has not yet been buried, because the effective cause is the same: the deceased over whom the prayer is offered is in the graveyard. This is also the established practice of the people: the funeral prayer is offered over the deceased in the graveyard, even before burial.
It may also be said that the prayer over the deceased does not enter under this prohibition in the first place, because the Prophet (peace and blessings be upon him) said, “The entire earth is a place of prayer,” meaning a place for prayer that involves prostration, whereas the funeral prayer contains no prostration.
His statement, “and a latrine”: a latrine is a place where a person relieves himself of urine or excrement; it is the toilet. Prayer performed there is invalid, because it is filthy and impure, and because it is a dwelling place of devils. Devils are wicked, and the places most beloved to them are the filthiest places. Allah the Exalted says: “Wicked women are for wicked men