—and that suffices for the present purpose. Al-Ḥāfiẓ Ibn Ḥajar says in Fath al-Bārī:
“In this ḥadith there is evidence for: (1) the permissibility of disposing of a privately owned graveyard through gift or sale; (2) the permissibility of exhuming long-abandoned graves when they are no longer inviolable; (3) the permissibility of performing prayer in the burial grounds of the polytheists after they have been dug up and cleared; and (4) the permissibility of building mosques on such sites.”
Furthermore, mosques are the dearest places on earth to Allah, as the Prophet ﷺ said:
“The most beloved places to Allah are the mosques.”
This ḥadith is narrated marfūʿ by Abū Hurayrah, may Allah be pleased with him, and it continues:
“And the most detested places to Allah are the marketplaces.”
Muslim recorded it through the chain of ʿAbd al-Raḥmān ibn Mihran, the freedman of Abū Hurayrah.
The report is supported by other narrations, among them the tradition of Jubayr ibn Muṭʿim: A man asked, “Messenger of Allah, which lands are most beloved to Allah and which are most disliked?” He replied, “I do not know until I ask Gabriel.” Gabriel then came to him and told him, “The most beloved spots to Allah are the mosques, and the most disliked spots to Allah are the markets.” Al-Mundhirī comments: “It was transmitted by Aḥmad and al-Bazzār—the wording is his—as well as by Abū Yaʿlā and al-Ḥākim, who declared its chain sound.”