8.48 Is it permissible to dig the graves of pagans of the period of Ignorance, and to use that place as a mosque?
٨۔٤٨ بَابُ هَلْ تُنْبَشُ قُبُورُ مُشْرِكِي الْجَاهِلِيَّةِ، وَيُتَّخَذُ مَكَانَهَا مَسَاجِدَ
[Machine] Translation: The Prophet ﷺ said, "May Allah curse the Jews; they took the graves of their prophets as places of worship." And there is no objection to praying near graves. Umar saw Anas ibn Malik praying near a grave and said, "The grave, the grave." But he did not command him to repeat the prayer.
لِقَوْلِ النَّبِيِّ ﷺ: «لَعَنَ اللَّهُ الْيَهُودَ، اتَّخَذُوا قُبُورَ أَنْبِيَائِهِمْ مَسَاجِدَ». وَمَا يُكْرَهُ مِنَ الصَّلاَةِ فِي الْقُبُورِ. وَرَأَى عُمَرُ أَنَسَ بْنَ مَالِكٍ يُصَلِّي عِنْدَ قَبْرٍ فَقَالَ الْقَبْرَ الْقَبْرَ. وَلَمْ يَأْمُرْهُ بِالإِعَادَةِ.