Thus did We make their case known to the people, that they might know that the promise of Allah is true, and that there can be no doubt about the Hour of Judgment. Behold, they dispute among themselves as to their affair. (Some) said, “Construct a building over them”: Their Lord knows best about them: those who prevailed over their affair said,“Let us surely build a place of worship over them.” (Quran 18:21)
Authentic classical Tafsir for this verse
Tafsir Number 1
Qadhi Thana Ullah Panipatti (Rahimuhullah) writes in his great Tafsir al Mazhari: After the death of Ashaab al Kahf a dispute occurred between Muslims and non-muslims, The Muslims said that they will make a Masjid over them because they were of our faith whereas the disbelievers said they will build other buildings on it where people will live….
This Ayah is proving that Mosques could be made near graves of Awliya in order to say salaat in them, Tabarruk is also attained through the tombs of Awliya [Tafsir al Mazhari Volume No.7, Page No. 123-124]
Tafsir Number 2
Tafsir by Imam Bayzawi (rah) says: “From this it is understood that to erect a Mausoleum for the special people, i.e. Pious Saints and Ulema, is permissible”.
Tafsir Number 3
Tafsir by Imam Fakhrud’deen Razi (rah) writes:
أن بعضهم قال: الأولى أن يسد باب الكهف لئلا يدخل عليهم أحد ولا يقف على أحوالهم إنسان. وقال آخرون: بل الأولى أن يبني على باب الكهف مسجد وهذا القول يدل على أن أولئك الأقوام كانوا عارفين بالله معترفين بالعبادة والصلاة
Translation: Some people said that the door of the cave should be closed so that nobody can enter it and the Ahwaal (of Ashab e Kahf) are kept hidden. Some people said that It is better to build a mosque at the door, this saying proves that these people were “ARIFEEN OF ALLAH WHO BELIEVED IN WORSHIPPING AND PRAYER”[Tafsir al Kabeer, Volume No. 5, Page No. 475]
Imam al-Razi also said:
ثم قال تعالى: {قَالَ ٱلَّذِينَ غَلَبُوا۴ عَلَىٰۤ أَمْرِهِمْ} قيل المراد به الملك المسلم، وقيل: أولياء أصحاب الكهف، وقيل: رؤساء البلد: {لَنَتَّخِذَنَّ عَلَيْهِم مَّسْجِدًا} نعبد الله فيه ونستبقي آثار أصحاب الكهف بسبب ذلك المسجد
Translation: And when Allah said {Those who prevailed over their affair} this refers to the “MUSLIM RULER” or the Awliya of Ashaab al Kahf (i.e. their momineen friends) or the leaders of town. {We will surely build a Mosque over them} so that we can “WORSHIP ALLAH” in it and due to it we will “PRESERVE THE RELICS OF ASHAAB AL KAHF”[Tafsir al-Kabeer, 5/475]
Tafsir Number 4
In “Tafseer Roohul Bayaan”, Vol. 3, according to the verse: “To build over the graves of the Ulema, Awliya and the Saliheen is a permissible act with this condition that the motive is that the greatness of these pious people must be made apparent so that the people don’t think that it is an ordinary grave.”
Tafsir Number 5
Imam Hakim (Rehmatullah Alaih) said in his Tafsir
قال الذين غلبوا على أمرهم} وهم المؤمنون, وكانوا غالبين في ذلك الوقت
Translation: {Those who prevailed over their affair} refers to the “MOMINEEN” and they prevailed over this matter in that time [Tafsir al Wahidi under 18:21]
Tafsir Number 6
Imam Jalal ud-din Suyuti (Rehmatullah Alaih) and Al Muhalli (Rehmatullah Alaih) explain in Tafsir al Jalalyn:
يَتَنَـٰزَعُونَ} أي المؤمنون والكفار {بَيْنَهُمْ أَمْرَهُمْۖ} أمر الفتية في البناء حولهم {فَقَالُوۤا۴} أي الكفار {ٱبْنُوا۴ عَلَيْهِم} أي حولهم {بُنْيَـٰنًاۖ} يسترهم {رَّبُّهُمْ أَعْلَمُ بِهِمْۚ قَالَ ٱلَّذِينَ غَلَبُوا۴ عَلَىٰۤ أَمْرِهِمْ} أمر الفتية وهم المؤمنون {لَنَتَّخِذَنَّ عَلَيْهِم} حولهم {مَّسْجِدًا} يصلى فيه، وفعل ذلك على باب الكهف.
Translation: They were disputing, that is, the believers and the disbelievers, among themselves their affair, the affair of the youths, with regard to building something around them [as a monument]; so they, the disbelievers, said, ‘Build over them, that is, around them, a building, to cover them up; their Lord knows them best.’
Those who prevailed regarding their affair, the affair of the youths, “NAMELY THE BELIEVERS”
We will verily set up over them, around them, a place of worship’, for prayers to be performed therein. And this indeed took place at the entrance of the cave.[Tafsir al Jalalyn, Volume No.1, Page No. 389]
Tafsir Number 7
Imam Nasafi (Rehmatullah Alaih) writes in his Tafsir al Nasafi:
قَالَ ٱلَّذِينَ غَلَبُوا۴ عَلَىٰۤ أَمْرِهِمْ} من المسلمين وملكهم
وكانوا أولى بهم وبالبناء عليهم {لَنَتَّخِذَنَّ عَلَيْهِم} على باب الكهف {مَّسْجِدًا} يصلي فيه المسلمون ويتبركون
Translation: {Those who prevailed over their affair} these are the
“MUSLIMS AND THE RULERS” who said to build over them i.e. on the door of cave a Masjid so that
“MUSLIMS CAN PRAY IN IT AND SEEK TABARRUK” [Tafsir al Nasafi, Volume No.3, Page No. 18]
Tafsir Number 8
Imam Abu Hayyan al Andalusi (Rehmatullah Alaih) said:
وروي أن التي دعت إلى البنيان كانت كافرة أرادت بناء بيعة أو مصنع لكفرهم فمانعهم المؤمنون وبنوا عليهم مسجداً
Translation: The person who told to make a building over them was a Kafir woman, she told to make a Church over them where deeds of Kufr can take place, however the momineen stopped her and made a Masjid over there instead [Tafsir Bahr al Muheet, Volume No. 7, Page No. 158]
Tafsir Number 9
Allama Ibn Jawzi (Rehmatullah Alaih) who is considered the most strict scholar and revered highly by Salafi Muslims, he states in his Tafsir under 18:21
قال ابن قتيبة: يعني المُطاعين والرؤساء، قال المفسرون: وهم الملك وأصحابه المؤمنون اتخذوا عليهم مسجداً
Translation: Ibn Qutayba (Rehmatullah Alaih) said that the Mufasireen said:
People who made Masjid were the (Muslim) King and his Momineen companions [Tafsir Zaad ul Maseer, Volume No. 5, Page No.124]
Tafsir Number 10
Imam Shahab ud-din Khafaji (Rehmatullah Alaih) wrote:
مسجد ايدل على جوازا لبناء على قبور الصلحاء ونحوهم كما اشار الي فى الكشاف وجواز الصلوة فى ذلك البناء
Translation: (Making mosque on cave) ”IS PROOF OF MAKING MOSQUES OVER THE GRAVES OF SALIHEEN” just like It is mentioned in Tafsir al Kashaaf and It is “PERMITTED” to pray inside this construction [Imam Khafaji in Inayatul Qadhi, Volume No. 6, Page No. 87, Published by Dar us Sadir, Beirut, Lebanon]
Tafsir Number 11
Mullah Ali Qari (Rehmatullah Alaih) writes:
أما من اتخذ مسجدا في جوار صالح أو صلى في مقبرة وقصد الإستظهار بروحه أو وصول أثر ما من أثر عبادته إليه لا للتعظيم له والتوجه نحوه فلا حرج عليه ألا ترى أن مرقد إسماعيل عليه السلام في المسجد الحرام عند الحطيم ثم أن ذلك المسجد أفضل مكان يتحرى المصلى لصلاته والنهي عن الصلاة في المقابر مختص بالقبور المنبوشة لما فيها من النجاسة كذا ذكره الطيبي وذكر غيره أن صورة قبر إسماعيل عليه السلام في الحجر تحت الميزاب وإن في الحطيم بين الحجر الأسود وزمزم قبر سبعين نبيا
Translation: Anyone who builds a mosque near the grave of an upright person or prays in the tomb (Maqbara) or intends to ask for help through the Ruh of that upright person or intends to seek barakah from his left overs, If he does all that without the intention of giving him Tazeem or doing tawajuh towards him ( in prayer)
“Then there is nothing wrong in that, don’t you see that Grave of Hadrat Ismail(A.S) is inside the Masjid ul Harram near the hateem and to Pray there is Superior than anything else ” however to pray near the graves is only forbidden when the soil becomes dirty because of Najasat of deceased… In the Hateem near Hajr al Aswad and Mizaab there are “Graves of 70 Prophets” [Mirqat, Sharh al Mishqaat, Volume No. 2, Page No. 202]
Mullah Ali Qari (Rehmatullah Alaih) also said:
وقد أباح السلف البناء على قبر المشايخ والعلماء المشهورين ليزورهم الناس ويستريحوا بالجلوس فيه
Translation: The early Muslims (Salaf) have considered it Mubah (i.e. allowed) to build over the graves of famous Mashaikh and Ulama so that people can visit them and sit there (easily) [Mirqaat Sharh al Misshqaat, Volume No. 4, Page No. 69]
So Indeed the Prophets, Mashaikh and Saliheen do not come under the prohibition because the grave of Prophet (Peace be upon him), Abu Bakr (Radhi’Allah anho), Umar (Radhi’Allah anho) and many other Prophets and Saliheen have remained “BUILT OVER”
Tafsir Number 12
Ibn khatir in his tafsir writes.
م { قَالَ ٱلَّذِينَ غَلَبُواْ عَلَىٰ أَمْرِهِمْ لَنَتَّخِذَنَّ عَلَيْهِمْ مَّسْجِدًا } حكى ابن جرير في القائلين ذلك قولين: [أحدهما] أنهم المسلمون منهم.
Translation: “When the people of the cave went into the cave, some people close to the entrance of the cave said, ‘Build a mosque so we can worship Allah.’ The people who said this were Muslims” [Tafsir Tabari, Tafsir Ibn Kathir, Sura al-Kahf, verse 21]
Tafsir Number 13
The famous commentator of Sahih Bukhari and leading scholar in sight of Sunnis and Salafis/wahabisies.
Imam Ibn Hajr al Asqalani (rah) writes in his magnificent Fath ul Bari:
In view of the fact that the Jews and Christians were taking the graves of their Prophets as their qibla for the purpose of respect, and were paying attention towards them at the time of their prayers, their graves took the position of idols. For this reason the Muslims have been forbidden from this action. However, if someoneconstructs a mosque near the grave of a pious person for the prupose of seeking tabarruk and not for prostration or paying attention towards them, he will never be included in this prohibition.
( Ibn Hajr al-‘Asqalani, Fath al-bari, vol. 3, p. 208)
for more on the proofs see:
About Shrines,Tombs,etc Religious Standings | ahlu sunnah wal jamat
i just dont know how to tell these wahabis to respect the other side of the argument.