Imām Aḥmad relates in his Musnad, with a sound chain of transmission, on the authority of ʿAbd Allāh ibn Masʿūd, that the Prophet (may Allah bless him and grant him peace) said:
“Among the most wretched of people are those upon whom the Hour overtakes while they are still alive, and those who turn graves into places of worship.” (1)
This was also recorded by Abū Ḥātim (2) in his Ṣaḥīḥ (3).
It is reported from Zayd ibn Thābit (may Allah be pleased with him) that the Messenger of Allah (may Allah bless him and grant him peace) said: “May Allah curse the Jews; they turned the graves of their prophets into mosques.” (4) Narrated by Imām Aḥmad. (5)
And Ibn ʿAbbās (may Allah be pleased with them both) said: “The Messenger of Allah (may Allah bless him and grant him peace) cursed the women who frequently visit graves, and those who build mosques over them and light lamps upon them.” Narrated by Aḥmad, Abū Dāwūd, al-Tirmidhī, and al-Nasāʾī. (6)
(1) Musnad Ahmad 1:435.
(2) The words “Reported by Abu Hatim in his Sahih” are absent from manuscript Aṭ.
(3) ʿAbd al-Razzaq records it in his Musannaf, through Maʿmar and al-Thawri, from Abu Ishaq and al-Harith, from ʿAli. I believe Maʿmar transmits it as a marfuʿ report with the wording: “Among the worst of people are those who turn graves into mosques.” See Musannaf 1:405, no. 1586, Book of Prayer at Graves.
(4) Manuscripts B and D, as well as the printed edition, insert the phrase “and the Christians.” I did not find this wording in Musnad Ahmad under the narration of Zayd ibn Thabit.
(5) Musnad Ahmad 5:184, 186 (Musnad of Zayd). Its isnad contains ʿUqbah b. ʿAbd al-Rahman, who is unknown to some hadith critics, though Ibn Hibban lists him among the reliable; see Tahdhib al-Tahdhib 7:245, no. 441. The remaining transmitters are trustworthy, and the author has already cited this hadith through sound chains agreed upon by al-Bukhari and Muslim.
(6) Musnad Ahmad 1:229, 287, 324, 337; Abu Dawud, Book of Funerals, chapter “Women visiting graves,” hadith no. 3236 (3:558); and al-Tirmidhi, Book of Prayer, chapter “The dislike of building a mosque over a grave,” hadith no. 320 (2:136). Al-Tirmidhi comments: “The hadith of Ibn ʿAbbas is hasan” (2:137). Considering all its chains and corroborating reports, it reaches the level of sahih. Its documentation has been mentioned above; see the Hadith Index.