they said, ‘Build a building over them. Their Lord knows them best.’ Those who had the say in their matter said, ‘We will set up a place of worship over them.’

(they said) i.e. the disbelievers said: (Build over them a building) a church because they are followers of our religion; (their Lord knoweth best concerning them. Those who won their point said) those whose argument did not prevail, i.e. the believers: (We verily shall build a place of worship over them) because they are followers of our religion; their difference being about this point.

Ibn Abbas said: They disputed over the building, and the mosque. The Muslims said: Build over them a mosque, because they are people of our religion. The polytheists said: Build over them a building, because they are from our tradition

Ibn Abbas ( رضي الله عنه) said: They disputed regarding the building. The Muslims said: Build over them a mosque where people pray for they are the people of our religion. The Polytheists said: Build over them a building for they are of our lineage.

They disputed over the building, and the mosque. The Muslims said: Build over them a mosque, because they are people of our religion. The polytheists said: Build over them a building, because they are from our tradition, said Ibn Abbas.

Ibn al-Jawzi also commented on the part of the verse {Those who had the say in their matter }:

قال المفسرون: وهم الملك وأصحابه المؤمنون اتخذوا عليهم مسجداً

The mufasiroon said: They are the King and his companions the believers, they built over them a mosque.

Ibn Abbas said: In building, the Muslims said: Build over them a mosque for the people to pray because they are of our religion. The polytheists said: Build over them a building because they are of our creed/belief.

Imam al-Tabari also quotes a comment of Ibn Abbas on those who built the mosque as : يعنـي عدوّهم (Meaning their enemies). But here it does not indicate whether they are believers or not. It probably just means that those who built the mosque were enemies of those who argued in wanting to construct a building. Nonetheless, we have quoted from so many mufassirs above the clear opinion of Ibn Abbas رضي الله عنه.

The Tabi’i, Abdullah ibn Obaid ibn Ameer, comments on the verse, as quoted by Imam al-Tabari:

Abdullah ibn Obaid ibn Ameer said: “……..The polytheists said: We will build a building over them, they are the sons of our fathers, and worship God in it, and the Muslims said: We have more right over them, we will surely build a mosque over them to pray therein and worship Allah in it.

Some of them said: Build over them a building, and some of them said, they are the believers: {Those who had the say in their matter said, ‘We will set up a place of worship over them.’}, they built a masjid at the door of the cave.

Abu Ishaq al-Zajaj (d. 311H) and Abu al-Layth al-Samarkandi (d. 375H), comments on the verse, as mentioned in the tafsir of al-Samarkandi:

The believers said they will build a mosque over them and the Christians said they will build a Church over them, the Muslim overcome them and built a masjid. Almighty said: {they said, ‘Build a building over them} meaning: mosque {Their Lord knows them best} meaning: their world {Those who had the say in their matter} meaning: Those who are on the religion of Ashab al-Kahf and they are the believers {said, ‘We will set up a masjid over them} (Abu Ishaq) al-Zajaj said: This is proof that, when the matter become apparent, the (believers) became triumphant and others then acknowledged the resurrection, because they have taken a mosque and the mosque is for the believers.

{Those who had the say in their matter} they are the Muslims and their king, and they were the first to build over them {We will set up} at the door of the cave {a mosque} for Muslims to pray therein and seek the barakah (blessings) of that place.

{Those who prevailed over their affair} this refers to the Muslim King, it is also said: they are the friends of Ashab al Kahf, and it is also said: They are the leaders of the town: {We will surely build a Mosque over them} so that we worship Allah in it and preserve the relics of the Ashab al-Kahf by means of this mosque.

{they said, ‘Build a building over them} i.e.: when they died, they said they we will build Mashahid and Mazarat on them, close to the Ambiya and Awliya, Ibrahim and Muhammed and other Prophets and saints, May peace be on all of them…………..{Said those who had the say in their matter} among their friends and those who ordered taking blessings from them and their place {We will set up a masjid over them} to pray in it.

{Those who had the say in their matter} they are the Muslims and their king, and they were the first to build over them {We will set up} at the door of the cave {a mosque} for Muslims to pray therein and seek the barakah (blessings) of that place.

{they said, ‘Build a building over them} The Muslims said: We will build over them a mosque, and the disbelievers said: We will build over them a Church. (……) {Those who had the say in their matter} by ability of argument, they are the monotheists the Muslims {We will set up} and build {a masjid over them} where we turn to God, and their tabaruk (blessings), and make it a place for needs and spending intimacy/communing, ……

{they said, ‘Build a building over them} at the door of the cave either to obscure their remains or to protect them and prevent them being taken or who wants to take from their soil barakah (blessings), and either to be a note on the cave to know them.

{Those who had the say in their matter} It is said: The king and it is said: The Muslims because they were more deserving than the disbelievers, They built at the door of the cave a Masjid to worship Allah.

{Said those who had the say in their matter} the Muslims and their King {We will set up a masjid over them} i.e., build on the door of the cave a masjid to pray therein and seek tabaruk (blessings) from the place.