Three Men in the Cave Hadith: The Story and Its Lessons
Contents
Three travelers take shelter in a cave. A rock rolls down the mountain and seals the entrance. No one knows they are there. The three men in the cave hadith is one of the stories the Prophet ﷺ told about people who came before us, and it ends with the rock moving away because of three sincere deeds.
At a glance
- Source: Sahih al-Bukhari 2272 (also Sahih Muslim 2743)
- Narrated by: ‘Abdullah ibn ‘Umar
- Grade: Sahih (agreed upon)
- Topic: Dua in hardship and sincere deeds
- Practise it: Do one good deed today that only Allah sees
The story of the three men in the cave
‘Abdullah ibn ‘Umar (may Allah be pleased with them both) said that he heard the Messenger of Allah ﷺ say:
انْطَلَقَ ثَلاَثَةُ رَهْطٍ مِمَّنْ كَانَ قَبْلَكُمْ حَتَّى أَوَوُا الْمَبِيتَ إِلَى غَارٍ فَدَخَلُوهُ، فَانْحَدَرَتْ صَخْرَةٌ مِنَ الْجَبَلِ فَسَدَّتْ عَلَيْهِمُ الْغَارَ فَقَالُوا إِنَّهُ لاَ يُنْجِيكُمْ مِنْ هَذِهِ الصَّخْرَةِ إِلاَّ أَنْ تَدْعُوا اللَّهَ بِصَالِحِ أَعْمَالِكُمْ. فَقَالَ رَجُلٌ مِنْهُمُ اللَّهُمَّ كَانَ لِي أَبَوَانِ شَيْخَانِ كَبِيرَانِ، وَكُنْتُ لاَ أَغْبِقُ قَبْلَهُمَا أَهْلاً وَلاَ مَالاً، فَنَأَى بِي فِي طَلَبِ شَىْءٍ يَوْمًا، فَلَمْ أُرِحْ عَلَيْهِمَا حَتَّى نَامَا، فَحَلَبْتُ لَهُمَا غَبُوقَهُمَا فَوَجَدْتُهُمَا نَائِمَيْنِ وَكَرِهْتُ أَنْ أَغْبِقَ قَبْلَهُمَا أَهْلاً أَوْ مَالاً، فَلَبِثْتُ وَالْقَدَحُ عَلَى يَدَىَّ أَنْتَظِرُ اسْتِيقَاظَهُمَا حَتَّى بَرَقَ الْفَجْرُ، فَاسْتَيْقَظَا فَشَرِبَا غَبُوقَهُمَا، اللَّهُمَّ إِنْ كُنْتُ فَعَلْتُ ذَلِكَ ابْتِغَاءَ وَجْهِكَ فَفَرِّجْ عَنَّا مَا نَحْنُ فِيهِ مِنْ هَذِهِ الصَّخْرَةِ، فَانْفَرَجَتْ شَيْئًا لاَ يَسْتَطِيعُونَ الْخُرُوجَ
“Three men from among those who were before you set out together until they reached a cave at night and entered it. A rock rolled down the mountain and closed the mouth of the cave. They said: ‘Nothing will save you from this rock except calling upon Allah by your righteous deeds.’ One of them said: ‘O Allah! I had two old parents, and I never gave my family or my servants their evening milk before them. One day I went far in search of something and did not come back until they had slept. I milked their evening drink for them and found them asleep, and I disliked giving my family anything before them. So I waited, with the bowl in my hand, until dawn broke, and they woke up and drank it. O Allah! If I did that seeking Your Face, relieve us from what we are in because of this rock.’ So the rock moved a little, but they could not get out.”
Sahih al-Bukhari 2272 · Narrated by ‘Abdullah ibn ‘Umar · Translation adapted from Sunnah.com
The first man’s deed was a quiet night of waiting, with a bowl of milk in his hand, so that his parents would come first.
The second man: leaving a sin he could commit
The Prophet ﷺ continued:
وَقَالَ الآخَرُ اللَّهُمَّ كَانَتْ لِي بِنْتُ عَمٍّ كَانَتْ أَحَبَّ النَّاسِ إِلَىَّ، فَأَرَدْتُهَا عَنْ نَفْسِهَا، فَامْتَنَعَتْ مِنِّي حَتَّى أَلَمَّتْ بِهَا سَنَةٌ مِنَ السِّنِينَ، فَجَاءَتْنِي فَأَعْطَيْتُهَا عِشْرِينَ وَمِائَةَ دِينَارٍ عَلَى أَنْ تُخَلِّيَ بَيْنِي وَبَيْنَ نَفْسِهَا، فَفَعَلَتْ حَتَّى إِذَا قَدَرْتُ عَلَيْهَا قَالَتْ لاَ أُحِلُّ لَكَ أَنْ تَفُضَّ الْخَاتَمَ إِلاَّ بِحَقِّهِ. فَتَحَرَّجْتُ مِنَ الْوُقُوعِ عَلَيْهَا، فَانْصَرَفْتُ عَنْهَا وَهْىَ أَحَبُّ النَّاسِ إِلَىَّ وَتَرَكْتُ الذَّهَبَ الَّذِي أَعْطَيْتُهَا، اللَّهُمَّ إِنْ كُنْتُ فَعَلْتُ ذَلِكَ ابْتِغَاءَ وَجْهِكَ فَافْرُجْ عَنَّا مَا نَحْنُ فِيهِ. فَانْفَرَجَتِ الصَّخْرَةُ، غَيْرَ أَنَّهُمْ لاَ يَسْتَطِيعُونَ الْخُرُوجَ مِنْهَا
“The second man said: ‘O Allah! I had a cousin who was the dearest of all people to me. I wanted her for myself, but she refused, until a year of famine struck her and she came to me. I gave her one hundred and twenty dinars on the condition that she would give herself to me, and she agreed. When I had power over her, she said: It is not lawful for you to break the seal except by its right. So I felt it a sin to fall into it, and I left her, though she was the dearest of all people to me, and I left the gold I had given her. O Allah! If I did that seeking Your Face, relieve us from what we are in.’ So the rock moved, but they still could not get out.”
Sahih al-Bukhari 2272 · Narrated by ‘Abdullah ibn ‘Umar · Translation adapted from Sunnah.com
“Except by its right” means through lawful marriage. Nobody would have known. He left the sin and the money at the very moment he was able to do it, only out of fear of Allah.
The third man: the worker’s wages
Then the Prophet ﷺ said:
وَقَالَ الثَّالِثُ اللَّهُمَّ إِنِّي اسْتَأْجَرْتُ أُجَرَاءَ فَأَعْطَيْتُهُمْ أَجْرَهُمْ، غَيْرَ رَجُلٍ وَاحِدٍ تَرَكَ الَّذِي لَهُ وَذَهَبَ فَثَمَّرْتُ أَجْرَهُ حَتَّى كَثُرَتْ مِنْهُ الأَمْوَالُ، فَجَاءَنِي بَعْدَ حِينٍ فَقَالَ يَا عَبْدَ اللَّهِ أَدِّ إِلَىَّ أَجْرِي. فَقُلْتُ لَهُ كُلُّ مَا تَرَى مِنْ أَجْرِكَ مِنَ الإِبِلِ وَالْبَقَرِ وَالْغَنَمِ وَالرَّقِيقِ. فَقَالَ يَا عَبْدَ اللَّهِ لاَ تَسْتَهْزِئْ بِي. فَقُلْتُ إِنِّي لاَ أَسْتَهْزِئُ بِكَ. فَأَخَذَهُ كُلَّهُ فَاسْتَاقَهُ فَلَمْ يَتْرُكْ مِنْهُ شَيْئًا، اللَّهُمَّ فَإِنْ كُنْتُ فَعَلْتُ ذَلِكَ ابْتِغَاءَ وَجْهِكَ فَافْرُجْ عَنَّا مَا نَحْنُ فِيهِ. فَانْفَرَجَتِ الصَّخْرَةُ فَخَرَجُوا يَمْشُونَ
“The third man said: ‘O Allah! I hired some laborers and gave them their wages, except one man who left his wage and went away. I invested his wage until it became a lot of wealth. After some time he came and said: O slave of Allah, pay me my wage. I said: All the camels, cows, sheep and slaves you see are from your wage. He said: O slave of Allah, do not mock me. I said: I am not mocking you. So he took it all and drove it away, and left nothing of it. O Allah! If I did that seeking Your Face, relieve us from what we are in.’ So the rock moved away and they walked out.”
Sahih al-Bukhari 2272 · Narrated by ‘Abdullah ibn ‘Umar · Translation adapted from Sunnah.com
He could have handed back the small original wage and kept the rest. Instead he gave the worker everything his money had grown into. Sahih Muslim reports the same story, also from Ibn ‘Umar (Sahih Muslim 2743).
What the three men in the cave hadith teach
HadeethEnc explains that the men told each other to call on Allah by the best deed each had done, hoping He would relieve their distress. Each man begins with “O Allah” and ends with “if I did that seeking Your Face”. They did not boast about their deeds; they offered them to Allah with the hope that they had been sincere.
The three deeds cover three relationships: with parents, with one’s own desires, and with the people who work for us. Allah answered them one by one, and the rock moved a little more each time.
Allah asks in the Quran:
أَمَّن يُجِيبُ ٱلْمُضْطَرَّ إِذَا دَعَاهُ وَيَكْشِفُ ٱلسُّوٓءَ وَيَجْعَلُكُمْ خُلَفَآءَ ٱلْأَرْضِ ۗ أَءِلَـٰهٌ مَّعَ ٱللَّهِ ۚ قَلِيلًا مَّا تَذَكَّرُونَ
“Is He [not best] who responds to the desperate one when he calls upon Him and removes evil and makes you inheritors of the earth? Is there a deity with Allāh? Little do you remember.”
Surah An-Naml 27:62 · Translation: Saheeh International, from Quran.com
Reflection: none of these men knew, on the night they waited with the milk, left the sin or counted the herd, that the deed would one day open a cave. Most of our good deeds are like that. We do them and forget them, and Allah keeps them for the day we need them most.
How to practise it
- Do one good deed today that nobody else will see, and keep it between you and Allah.
- Put your parents first in something small this week: food, time, or a phone call.
- If a sin is within easy reach and nobody would know, leave it for Allah, like the second man.
- Pay what you owe on time, and be generous with people who work for you.
- When you are in difficulty, call on Allah and ask Him by a sincere deed you have done. This is what the men in the hadith did.
Questions people ask
Is the story of the three men in the cave authentic?
Yes. It is in Sahih al-Bukhari 2272 and Sahih Muslim 2743, narrated by ‘Abdullah ibn ‘Umar, and HadeethEnc grades it an authentic hadith narrated by Bukhari and Muslim.
Are the three men in the cave the same as the People of the Cave in Surah al-Kahf?
No. The People of the Cave (Ashab al-Kahf) in Surah al-Kahf are young believers who slept in a cave for many years. The three men in this hadith are different people from before our time, whose story the Prophet ﷺ told.
Can I make dua by mentioning my good deeds?
In this hadith the men called on Allah by their righteous deeds, and the Prophet ﷺ told the story with approval of how Allah saved them. Make sure it is with humility, never as a claim on Allah, and ask a qualified scholar if you are unsure.
Key lessons

- In hardship, turn to Allah first: the men’s first plan was dua.
- Honoring parents is a deed Allah keeps and rewards.
- Leaving a sin while able to commit it is a sign of true fear of Allah.
- Giving people their full rights, and more, is part of faith.
- Sincerity is what made each deed count: “if I did that seeking Your Face”.
A question to sit with tonight: if you were in that cave, which of your deeds would you dare to mention?
Save this to Pinterest so you can come back to the three men in the cave hadith

Share the reward. Send this article to someone who needs it today — teaching a hadith or dua can become a lasting good deed for you, in shaa Allah.






