Islamic History · July 1, 2026

The Companions of the Cave (Ashab al-Kahf)

Exalted Allah said in the Noble Qur'an: "Or have you thought that the companions of the cave and the inscription were, among Our signs, a wonder?" A group of young men sought refuge in the cave and said: "Our Lord, grant …

Exalted Allah said in the Noble Qur'an:

"Or have you thought that the companions of the cave and the inscription were, among Our signs, a wonder?"

A group of young men sought refuge in the cave and said: "Our Lord, grant us from Yourself mercy and prepare for us from our affair right guidance." So We cast [a cover of sleep] over their ears within the cave for a number of years. Then We awakened them that We might make clear which of the two factions was most precise in calculating what [extent] they had remained in time."

O Muhammad! We relate to you their story in truth. Indeed, they were youths who believed in their Lord, and We increased them in guidance and made firm their hearts when they stood up and said: "Our Lord is the Lord of the heavens and the earth. Never will we invoke besides Him any deity. We would have certainly spoken, then, an excessive transgression. These, our people, have taken besides Him deities. Why do they not bring for [worship of] them a clear authority? And who is more unjust than one who invents about Allah a lie?" And it was said to them: "And when you have withdrawn from them and that which they worship other than Allah, retreat to the cave; your Lord will spread out for you of His mercy and will prepare for you from your affair facility."

If you had looked, you would have seen the sun when it rose, inclining away from their cave on the right, and when it set, passing away from them on the left, while they were [lying] within an open space thereof. That was from the signs of Allah. He whom Allah guides is the [rightly] guided, but he whom He leaves astray – never will you find for him a protecting guide.

And you would think them awake, while they were asleep. And We turned them to the right and to the left, while their dog stretched his forelegs at the entrance. If you had looked at them, you would have turned from them in flight and been filled by them with terror.

And We awakened them so that they might question one another. One of them said:

"How long have you remained [here]?"

They said, "We have remained a day or part of a day." They said, "Your Lord is most knowing of how long you remained. So send one of you with this silver coin of yours to the city and let him look to which is the best food and bring you provision from it and let him be cautious. And let no one be aware of you."

"For indeed, if they come to know of you, they will stone you or return you to their religion. And never would you succeed, then – ever."

And thus We made their case known to the people that they might know that the promise of Allah is truth and that of the Hour there is no doubt. [That was] when they disputed among themselves about their affair and said, "Construct over them a structure. Their Lord is most knowing about them." Said those who prevailed in the matter, "We will surely take [for ourselves] over them a masjid." And they will say, "They were three, the fourth of them being their dog"; and they will say, "They were five, the sixth of them being their dog," guessing at the unseen; and they will say, "They were seven, and the eighth of them was their dog."

Say, "My Lord is most knowing of their number. None knows them except a few."

So do not argue about them except with an obvious argument and do not inquire about them among [the speculators] from anyone. And never say of anything, "Indeed, I will do that tomorrow," except [when adding], "If Allah wills." And remember your Lord when you forget and say, "Perhaps my Lord will guide me to what is nearer than this to right conduct."

And they remained in their cave for three hundred years and exceeded by nine. Say, "Allah is most knowing of how long they remained. He has [knowledge of] the unseen [aspects] of the heavens and the earth. How Seeing is He and how Hearing! They have not besides Him any protector, and He shares not His legislation with anyone."

O Muhammad! Recite what has been revealed to you of the Book of your Lord. There is no changer of His words. And never will you find in other than Him a refuge." (al-Kahf 18:9-27)

The reason for the revelation (asbāb al-nuzūl) of the story of the Companions of the Cave and the verses concerning Dhu’l-Qarnayn is narrated by Muḥammad b. Isḥāq and other scholars of sīra in the work "al-Sīra". According to this account, the Quraysh sent men to the Jews to test and challenge the Messenger of God (peace be upon him), and the Jews gave them some difficult questions. The Jews told the Quraysh: Ask Muhammad about a people who disappeared in ancient times and whose fate is unknown, about the man who traveled the earth (Dhu’l-Qarnayn), and about the nature of the Spirit (rūḥ).

Thereupon, Allah Most High revealed to the Prophet (peace be upon him) the verses concerning the Spirit, Dhu’l-Qarnayn, and the Companions of the Cave:

"They ask you, [O Muhammad], about the Spirit..."

"They ask you about Dhu’l-Qarnayn..."

"Or have you thought that the companions of the cave and the inscription were, among Our signs, a wonder?"

That is, these matters are not more astonishing than the other reports and manifest miracles and wonders to which you have been made privy.

The word "Kahf" in the verse means a cave in a mountain.

Shuʿayb al-Jubāʾī said: "The name of the cave of the Companions of the Cave was 'Hayzam'."

As for the word "Raqīm" in the verse, Ibn ʿAbbās said: "I do not know what it means." Some say it means an inscription, and that the names of the Companions of the Cave were written on it, and that their story was recorded there after them. Ibn Jarīr and others adopted this view. Others say that "Raqīm" is the name of the mountain where their cave was located. Ibn ʿAbbās and Shuʿayb al-Jubāʾī said: "The name of the mountain where their cave was is Mount Banajlus." Some say Banajlus is the name of the valley next to the caves, and others say it is the name of a village there. Allah knows best.

According to Shuʿayb al-Jubāʾī, the name of the dog of the Companions of the Cave was Himrān. The Jews' interest in their story proves that the Companions of the Cave lived in very ancient times. Some exegetes say they lived after the Messiah and were Christians. As is apparent from the verse, their people were polytheists who worshipped idols. According to many exegetes and historians, the Companions of the Cave lived during the reign of the ruler Decius (Dakyanus) and were sons of the nobility in the state. Some say they were sons of the ruler. On a festival day, when they saw their people prostrating to idols, Allah lifted the veil of heedlessness from their hearts, guided them, and they realized their people were not upon a sound religion. Therefore, they left the religion of their people and turned to worship the One and Only Allah. It is said that each of them, when their hearts were illuminated with the faith of tawhid (the oneness of God), withdrew from the crowd and gathered together. As narrated in a sound hadith in al-Bukhārī, the Prophet (peace be upon him) said:

"Souls are like recruited soldiers. Those that are similar in qualities and character get along, and those that are dissimilar differ."

Each of the Companions of the Cave who withdrew from their people asked about the state and condition of the others, and each explained their situation. Thus, they all decided to separate from their people and flee to save their religion. This is the legitimate course of action in times of tribulation and evil. As Allah the Exalted said:

"We relate to you their story in truth. Indeed, they were youths who believed in their Lord, and We increased them in guidance and made firm their hearts when they stood up and said: 'Our Lord is the Lord of the heavens and the earth. Never will we invoke besides Him any deity. We would have certainly spoken, then, an excessive transgression. These, our people, have taken besides Him deities. Why do they not bring for [worship of] them a clear authority?'" That is, should they not bring a clear proof that what they are upon is truth? "And who is more unjust than one who invents about Allah a lie?" And it was said to them: "You have separated from them and from what they worship besides Allah."

That is, you have separated from the misguided religion of your people and from the gods they worship besides Allah, for they associated other gods with Allah. As Abraham (peace be upon him) said:

"Indeed, I am free from what you worship except for He who created me; and indeed, He will guide me." (al-Zukhruf 43:27)

So these youths said to each other: Since you have separated from the religion of your people, then also distance yourselves physically so that you may be safe from their harm. "Therefore, retreat to the cave; your Lord will spread out for you of His mercy and will prepare for you from your affair facility." That is, your Lord will shield you and bring you under His protection, and your situation will end well. As in the hadith: "O Allah, make the outcome of all our affairs good, and protect us from the disgrace of this world and the punishment of the Hereafter."

The cave in which the Companions of the Cave stayed is described in the Qur'an as follows: The entrance of the cave faced north, and its depth (back) faced the qibla (direction of prayer). Such a location is the most beneficial: if the cave faces the qibla and its entrance is to the north, it is very advantageous. As the verse says: "If you had looked, you would have seen the sun when it rose, inclining away from their cave on the right, and when it set, passing away from them on the left, while they were [lying] within an open space thereof." In summer and hot days, the sun would shine into the west side of the cave at sunrise. Gradually, sunlight would enter from the right, illuminating the interior. Then, as the sun rose to the middle of the sky, it would again move to the west, reducing the light inside, and at sunset, sunlight would enter gradually from the east.

In such a position, the sun would enter the cave in this way. Sometimes, the wisdom behind the sun entering the cave like this was to preserve their appearance. "They were [lying] within an open space thereof. That was from the signs of Allah." That is, their remaining in the cave for such a long time without food or drink or bodily nourishment is among the manifest proofs and evidences of Allah's supreme power. "He whom Allah guides is the [rightly] guided, but he whom He leaves astray – never will you find for him a protecting guide. And you would think them awake, while they were asleep." Some said their eyes were open, so they appeared awake, and this was so their eyes would not be damaged by the long sleep. "We turned them to the right and to the left."

According to one opinion, they were turned from right to left or left to right once a year, or perhaps more often. Allah knows best. "Their dog stretched his forelegs at the entrance." Shuʿayb al-Jubāʾī said the dog's name was Himrān. The point is that their dog, which accompanied them when they left their people, stayed with them but only guarded at the entrance, stretching its forelegs at the threshold and not entering the cave. This was out of etiquette, and among the honors given to them, for angels do not enter a house where there is a dog. Therefore, the dog did not enter but waited at the door. Loyalty to a people or a person affects even a dog. The dog stayed with them as long as they were in the cave. Whoever is with a people is happy with them.

If this is the case for a dog, consider the case of a human who follows righteous people! Such a person is certainly worthy of honor. Many storytellers and exegetes have narrated lengthy reports about this dog, most of which are from Isra'iliyyat (Judeo-Christian traditions) and are false and useless, just like the disputes about the dog's name and color, which are also useless and false.

Scholars have differed about the location of the cave of the Companions of the Cave. Many say it was in the land of Eyle, others say in the land of Nineveh, others in the land of Belqa, and there is a narration that it was in the lands of the Byzantines, which is closer to the truth. Allah knows best. Allah has informed us of the most beneficial aspects of their story and described what is important for us. Whoever listens to the Qur'anic verses about this matter can almost see them and their situation. Allah, who informs about them, has witnessed their state and the condition of their cave, how they were turned from right to left and left to right, and how their dog stretched its forelegs at the threshold. Our Lord said:

"If you had looked at them, you would have turned from them in flight and been filled by them with terror." This proves that hearing about something is not like seeing it. As the hadith says, what is reported is as if it has occurred, but in this verse, the fleeing and fear mentioned did not actually occur.

Allah the Exalted tells us that after 309 years of sleep, He awakened them, and when they awoke, they said to each other: "One of them said: How long have you remained? They said: We have remained a day or part of a day. They said: Your Lord is most knowing of how long you remained. So send one of you with this silver coin of yours to the city (that is, give the money you have to one of you and send him to the city of Defsus), let him look for the best food and bring it to you." That is, let him bring you food. This shows their asceticism and scrupulousness. "Let him be cautious (be polite when entering the city), and let no one be aware of you." They said: "For if they come to know of you, they will stone you or return you to their religion. And never would you succeed, then – ever." For Allah has saved you from that religion. The Companions of the Cave thought they had slept for a day or a little more, so they spoke thus.

But in fact, their state had changed, their cities and people had changed, and those who lived in their time had passed away and new generations had come. Therefore, when one of them—according to reports, Tizosis—entered the city in disguise so as not to be recognized, he did not recognize the city or its people. The people of the city were surprised by his appearance, characteristics, and money. It is said that they arrested him, fearing he was a spy or would cause harm, and brought him to the authorities. According to another report, Tizosis escaped from the people. In another narration, Tizosis explained his situation and that of his companions and what had happened to them, and took some people with him to show them the cave.

When they approached the cave, Tizosis entered to join his companions and informed them of what had happened and how long they had slept, and they understood that this was decreed by Allah. It is said that they fell asleep again, or according to another narration, they died.

As for the people of the city, it is said they could not find the cave where the Companions of the Cave were sleeping. Allah did not show it to them. According to another narration, they could not enter the cave out of fear or awe of the Companions of the Cave. The people of the city disputed about the Companions of the Cave. Some said: "Build a structure over their cave," so that those inside would not come out and cause harm.

Those who prevailed said: "We will surely take [for ourselves] over them a masjid." That is, let us build a blessed place of worship next to these righteous people. This was a custom among previous communities. As for our sharia (sacred law), as established in the sound collections of al-Bukhārī and Muslim, the Messenger of God (peace be upon him) said:

"May Allah curse the Jews and Christians, for they took the graves of their prophets as places of worship." That is, the Prophet (peace be upon him) warned us against what they did.

Allah the Exalted says in a verse: "And thus We made their case known to the people that they might know that the promise of Allah is truth and that of the Hour there is no doubt."

Many exegetes said: Allah informed people about their situation and location so that people would know that the Hereafter and the Resurrection are real and certain. After learning that the Companions of the Cave awoke after sleeping for more than 300 years without any change in their bodies, people would understand that Allah, who kept them alive, can also give life to bodies that have decayed and been eaten by worms. Even after their bodies and bones have crumbled, Allah will resurrect the dead. The believers have no doubt about this.

"His command is only when He intends a thing that He says to it, 'Be,' and it is." (Yā Sīn 36:82) In the verse "that they might know that the promise of Allah is truth and that of the Hour there is no doubt...", the verb "know" may refer to people or to the Companions of the Cave, or to both together. Allah knows best. Then Allah says: "They will say, 'They were three, the fourth of them being their dog'; and they will say, 'They were five, the sixth of them being their dog'; and they will say, 'They were seven, and the eighth of them was their dog.'"

Allah declares that people have expressed different opinions about the number of the Companions of the Cave, mentioning three views, of which the third is preferred over the first two. This indicates that their number was seven, and their dog was the eighth. If there were another valid opinion, Allah would have mentioned it. If the third view were not correct, Allah would have indicated so. It is inappropriate to dispute about such matters. Therefore, Allah advised the Prophet (peace be upon him) to be courteous in such matters and to say "Allah knows" when people differ. Thus, Allah said:

"Say, 'My Lord is most knowing of their number. None knows them except a few. So do not argue about them except with an obvious argument.'"

That is, be gentle in this matter. Do not engage in disputes about such things. Do not ask anyone about the situation of the Companions of the Cave. For this reason, Allah left their number ambiguous at the beginning of the story, saying: "They were youths who believed in their Lord." If there were any benefit in specifying their number, Allah, who knows the seen and unseen, would have informed us. Allah says:

"And never say of anything, 'Indeed, I will do that tomorrow,' except [when adding], 'If Allah wills.' And remember your Lord when you forget and say, 'Perhaps my Lord will guide me to what is nearer than this to right conduct.'"

This is a great etiquette that Allah showed and taught His Prophet, and He encouraged His creatures to adhere to it. The rule of etiquette recommended in the verse is: when someone says they will do something in the future, they should say insha’Allah (if Allah wills), so that their resolve is strengthened. For the servant does not know what will happen tomorrow, nor whether what he intends is decreed by Allah. Saying insha’Allah is not to make the action conditional, but to show firmness of intention. For this reason, Ibn ʿAbbās said: "The phrase 'insha’Allah, I will do it' is valid for up to a year." In the story of Solomon, as related, he said: "Tonight I will go to seventy of my wives, and each will bear a son who will fight in the way of Allah." He was told to say insha’Allah, but he did not, and though he visited all his wives, none bore a child except one, who gave birth to a half-formed child. The Messenger of God (peace be upon him) said: "By Him in whose hand is my soul, if he (Prophet Solomon) had said insha’Allah, his word would have come true and he would have attained what he wished."

"And remember your Lord when you forget." For forgetfulness sometimes comes from Satan, but remembering Allah drives Satan away from the heart and helps one remember what was forgotten.

"And say: 'Perhaps my Lord will guide me to what is nearer than this to right conduct.'" When a matter becomes difficult or people differ, turn to Allah so that He may make your affair easy and grant you success.

"And they remained in their cave for three hundred years and exceeded by nine." Allah mentioned the long stay of the Companions of the Cave in the cave because of its great benefit. As for the addition of nine years to three hundred, this is to equate lunar (qamarī) years with solar (shamsī) years, for 300 solar years correspond to 309 lunar years, since every hundred solar years equals 103 lunar years.

"Say: 'Allah is most knowing of how long they remained.' If you are asked about this and have no report, refer the answer to Allah, the Mighty and Majestic. "To Him belongs the unseen of the heavens and the earth." That is, Allah knows the unseen. None of His creatures knows the unseen except whom He wills. "How Seeing is He and how Hearing!" Allah puts everything in its proper place for His creatures. "They have not besides Him any protector, and He shares not His legislation with anyone." That is, your Lord is the sole sovereign, acting alone. He has no partner.