that they swore an oath to build a mosque.
Yet if you refuse to assume anything but good of the second group, you may say: their building of a mosque “over them” was not of the same type as the condemned practice of erecting mosques upon graves—whose perpetrators are cursed. Rather, it was the establishment of a mosque beside them, close to the entrance of their cave. This sense of proximity is stated explicitly in the versions of the story related by Al-Suddi and Wahb. Such a construction is unobjectionable; at most, it merely links the mosque to the cave in which they lay, just as the Prophet’s Mosque is linked to the honored resting place—may Allah bless and grant peace to the one within. Their words, “We shall surely build a mosque over them,” then, simply mirror the first party’s words, “Build a structure over them.”
If you prefer, you could say that the mosque was built on top of the cave, upon the mountain in which it was located. Mujāhid reports that the king left them in their cave and built a mosque above it. This reading is closer to the apparent wording, as is clear. All of this interpretive effort is only necessary if it is maintained that