What is the position of Imam An-Nawawi on building upon graves? Imam An-Nawawi writes that it is agreed from the texts of Ash-Shafi‘i and his companions that it is disliked to build a masjid on a grave regardless of whether the dead person is a famous pious person or otherwites. This is in the general hadiths. Ash-Shafi‘i and his companions said, "It is disliked to pray on the graves whether the dead is righteous or otherwise." Hafidh Abu Musa said, "Imam Abul Hasan Zafarani, may Allah have mercy upon him, said, 'And do not pray on the grave, and do not seek blessings from it (Tabarruk).'" [Majmoo Sharah Madhab vol. 5 p. 289] On the other hand, he says in his book Rawdat At-Talibeen Kitab Al-Wasaya, Baab Al-Awwal Arkan Al-Wasaya that it is permissible to build over graves of Prophets and pious people for the purpose of visitation and Tabarruk (seeking blessings). Is it so that he disapproved of building a masjid over the grave (i.e. to pray near them) but approved constructing a building over the graves so that they may be visited in order to seek blessings from them?
All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
There is no contradiction between what Imam An-Nawawi said in Al-Majmooʻ and what he said in Ar-Rawdhah. This is because his statement in Al-Majmooʻ explicitly targets taking the graves as masjids, meaning performing the prayer on the grave or at it to seek blessings from the grave. He said in Al-Majmooʻ, "It is disliked to pray towards the graves ... and he should not pray in the direction of the grave or at the graveside to seek blessings from it and out of glorifying it given the prohibition stated in the relevant hadiths." [Al-Majmooʻ]
His statement in Ar-Rawdhah, on the other hand, refers to building a sign to mark the location of the grave in order for it to be recognized as a grave so that people would not tread over it and the wild animals would not dig it out. This is what the Shaafiʻi scholars of Fiqh said. Zakariyya Al-Ansaari wrote in his commentary on An-Nawawi's statement in Ar-Rawdhah about the graves of the Prophets, the scholars, and the pious:
"The author of Ath-Thakhaa'ir said, 'Perhaps the intended meaning is building domes or arched roofs over their graves, like those in shrines, if the burial is in a place owned by them or by the one who buried them therein, not building the graves themselves, given the prohibition in this regard or doing this in graveyards donated to be endowments for Muslims, as it makes the graveyard narrow (and thus would not accommodate many dead bodies).' Az-Zarkashi said, 'This view needs further investigation, and the ruling differs accordingly; it is most likely that the intended meaning of building them is to put the dust back into the graves and guarding them out of the fear that wild animals might unearth them, and reciting the Quran at the graveside, and informing the visitors that this area contains graves so that it would not be obliterated. The first meaning is the first to come to one's mind... '"
As you can see, his statement in Ar-Rawdhah was not about building masjids over graves. The Shaafiʻi scholars of Fiqh also stated that if there is anything built on the grave, it should be demolished.
Ash-Shirbeeni wrote:
"It is disliked to kiss the bier placed over the grave, and it is disliked as well to kiss or touch the grave and kiss the threshold when going in to visit the graves of the pious. These are all Bid‘ahs (religious innovations) committed by people. Allah, the Exalted, says (what means): {Then is one to whom the evil of his deed has been made attractive so he considers it good (like one rightly guided)?} [Quran 35:8] If anything is built over a grave in the graveyard donated for the benefit of Muslims, wherein the people of the town customarily bury their dead, it must be demolished, because it makes the graveyard rather narrow. There is no difference between building a dome, a house, a masjid, or otherwise (over the grave in terms of the religious ruling)." [Mughni Al-Muhtaaj]
Likewise is the statement of An-Nawawi:
"Ash-Shaafiʻi and the (Shaafiʻi) scholars held that it is disliked to plaster the grave, to write the name of the deceased or otherwise on it, or to build on it, and there is no difference of opinion about this in our school ... Our scholars said that there is no difference between building a dome, a house, or other than that (over the grave in terms of the relevant ruling). If the graveyard is donated for the benefit of Muslims, it is prohibited to build on the grave. Our scholars said that such a building must be demolished, and there is no difference of opinion in this regard."
We have previously underlined in many fatwas that it is impermissible to seek blessings from the graves of the pious and to supplicate at the graveside, as this might lead to Shirk (polytheism), as happens with many people who do not only visit such graves and derive blessings from them, but, rather, supplicate to the dead, seek relief from them, and offer animal sacrifices to them. Had Imam An-Nawawi and other early scholars witnessed the evil consequences brought about by the scholarly opinion that it is allowed to build a structure over a grave, they would have issued fatwa to forbid it. Imam Ash-Shaafiʻi himself, when he mentioned that it is disliked to build a masjid over a grave, justified this by the fact that people are not safe from Fitnah (temptation/tribulation) and misguidance as a result. He said in his book Al-Umm:
"I dislike that a masjid be built over a grave and levelled with the ground or that prayer is performed over it when it is not levelled or that one prays towards it... And if someone prayed towards it, his prayer is sufficient (in terms of being cleared of his liability from the obligation); however, he committed a misdeed. Maalik informed us that the Messenger of Allah, sallallaahu ‘alayhi wa sallam, said, 'May Allah fight the Jews and the Christians; they took the graves of their Prophets as masjids (places of worship). Two religions shall not co-exist in the land of the Arabs.' I believe that this action is disliked, as it goes against the Sunnah (the practice of the Prophet, sallallaahu ‘alayhi wa sallam), and it is contrary to the reports narrated in this regard. And it is disliked – Allah knows best – that a Muslim be glorified, meaning that his grave is taken as a masjid, and this may lead to Fitnah and misguidance for those who will come (after us)..." [Al-Umm]
Allah knows best.
You can search for fatwa through many choices