It goes without saying that one of the rights of a deceased Muslim over his fellow Muslims is to offer the funeral prayer for him. There is consensus among all the great Muslim jurists that the funeral prayer for a deceased person is a collective obligation or fard kifayah. The Prophet (peace and blessings be upon him) commanded the Muslims to offer it, and they have been doing so ever since they received this command. As for the issue of where the funeral prayer should be offered, it should be known that it may be offered either inside or outside the mosque. However, it is left to the authorities of each mosque to make a policy whether they wish to pray inside or outside the mosque.
Sheikh Ahmad Kutty, a senior lecturer and Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, states: “During the Prophet’s time, the janazah (funeral prayer) was most commonly held outside the precincts of the mosque. However, there were times when the Prophet (peace and blessings be upon him) prayed janazah inside the mosque. As `A’ishah, the Mother of Faithful, told us: The Prophet (peace and blessings be upon him) prayed for Suhayl inside the mosque.
The Prophet’s companions, who were fully aware of the Prophet’s practice, did not find it objectionable to hold the janazah prayer inside the mosque. It is no wonder, then, that the prayers for both Caliphs Abu Bakr and `Umar were held inside the mosque. The fact that none of the companions objected to this is a clear indication of the consensus among them on this issue. In short, there is no objection to praying janazah in a mosque. It is not opposed to the Sunnah of the Prophet (peace and blessings be upon him). It is common knowledge today that janazah is regularly held inside the precincts of the two sacred mosques of Makkah and Madinah.
It is, however, left to the authorities of each mosque to make a policy whether they wish to pray inside or outside the mosque. Fear of defiling the mosque because of deterioration of the corpse is a valid reason for praying outside.”
In his well-known book, Fiqh As-Sunnah, Sheikh Sayyed Sabiq states:
“There is no harm in offering funeral prayer in a mosque if there is no danger of it becoming unclean. This is based on a narration of Muslim from `A’ishah who said: “The Prophet (peace and blessings be upon him) offered a funeral prayer for Suhayl ibn Bayda in the mosque, and the Companions likewise offered funeral prayer for Abu Bakr and `Umar in the mosque, and no one objected to it, because the funeral prayer is similar to other (formal) prayer.”
Abu Hanifah and Malik do not approve of it, citing a hadith of the Prophet (peace and blessings be upon him) to the effect that whoever offers a funeral prayer in the mosque would have nothing (i.e., no reward). This statement not only contradicts the practice of the Prophet (peace and blessings be upon him) and his Companions, but is also a weak hadith due to other reasons.
Ahmad ibn Hanbal said: “This is a weak hadith and is reported through a single transmitter, Salih, the freed slave of Al-Tawamah, and he is an unreliable narrator. Some scholars, however, hold that this hadith of the Prophet (peace and blessings be upon him) is sound, and the words, reported by Abu Dawud, ‘Whoever offers a funeral prayer in a mosque would have nothing,’ mean such a person would not incur any burden (of sin). Ibn Al-Qayyim said: ‘It was not the usual practice of the Prophet (peace and blessings be upon him) to offer a funeral prayer in the mosque. Rather he would usually offer funeral prayers outside the mosque except when for some reason he had to offer it in the mosque. In certain cases he did offer funeral prayer in the mosque, as in the case of Ibn Bayda, which shows that funeral prayer may be offered either inside or outside the mosque, but to do so outside the mosque is preferable.”