I heard from the Messenger of Allah (ﷺ) five days before his death and he said: I stand acquitted before Allah that I took any one of you as friend, for Allah has taken me as His friend, as he took Ibrahim as His friend. Had I taken any one of my Ummah as a friend, I would have taken Abu Bakr as a friend. Beware of those who preceded you and used to take the graves of their prophets and righteous men as places of worship, but you must not take graves as mosques; I forbid you to do that.
Hadith Text & Context
This profound narration from Sahih Muslim 532 was delivered by the Prophet Muhammad (ﷺ) merely five days before his passing, making it among his final counsels to the Ummah. It emphasizes his exclusive spiritual friendship (Khullah) with Allah, mirroring the esteemed status of Prophet Ibrahim (عليه السلام).
Exclusive Divine Friendship (Khullah)
The Prophet's declaration of being the "friend of Allah" (Khalil Allah) is a station of immense proximity and love, distinct from general belief (Iman). He clarifies that his ultimate loyalty and intimate friendship are reserved for Allah alone, precluding any worldly or exclusive human allegiance that might compromise this divine bond.
His subsequent statement regarding Abu Bakr As-Siddiq (رضي الله عنه) is not a contradiction but the highest form of human commendation. It signifies Abu Bakr's unparalleled virtue, faith, and companionship, acknowledging him as the most deserving of brotherly love and trust among all people, had such a purely human friendship been his mandate.
Prohibition of Grave Worship & Mosque Construction
This is a critical and emphatic warning against the practices of previous nations, specifically the People of the Book. They fell into deviation by venerating the graves of their prophets and righteous people to the extent of building places of worship over them, which inevitably led to shirk (associating partners with Allah).
The phrase "you must not take graves as mosques" has two primary interpretations according to classical scholars: Firstly, it forbids performing the ritual prayer (Salah) directly facing a grave. Secondly, and more severely, it prohibits building mosques over graves, thereby preventing any act that could facilitate the glorification of the inhabitants of those graves alongside Allah.
Scholarly Commentary & Legal Ruling
Imam An-Nawawi, in his commentary on Sahih Muslim, underscores that this hadith establishes a foundational principle of Islamic creed (Aqidah). It strictly forbids any action that could become a means to shirk, particularly the excessive veneration of the righteous, even if initially intended as honor.
The ruling derived is that it is categorically forbidden (Haram) to build a mosque over a grave or to bury a deceased person inside a mosque. Visiting graves is permissible for the purpose of reflection and reminding oneself of the Hereafter, but any form of supplication to the deceased, seeking their intercession independently of Allah, or acts of worship at the gravesite are grave innovations (Bid'ah) and deviations from pure Tawhid.