The Three Men Trapped in a Cave

A rock sealed the cave. They had no way out except one: the good they had done only for Allah.

3 min read · Reviewed 19 October 2026 · Told only from authentic hadith, linked to sunnah.com

In short: Three travellers sheltered in a cave for the night, and a rock rolled down and sealed it. Each man asked Allah by a deed he had done sincerely for Him: one for his parents, one for walking away from sin, one for his honesty with a worker. With each dua the rock moved, and after the third they walked out (Sahih al-Bukhari 2272).

The story

The Prophet ﷺ told of three men from the people before us who set out together and took shelter in a cave at night. A huge rock rolled down the mountain and closed its mouth. They said to each other that nothing would save them except calling on Allah by a good deed each had done purely for His sake.

The first man: his parents

He had elderly parents and never gave his family milk before them. One night he came home late and found them asleep. He would not wake them, and he would not feed his family first, so he stood holding the bowl until dawn, when they woke and drank. He asked Allah: if I did that for You, relieve us. The rock moved a little, but not enough to get out.

The second man: walking away from sin

He loved a cousin of his and wanted to sin with her. In a year of famine she came to him in need, and he gave her money on that condition. When he was about to do it, she reminded him of Allah and that this was only lawful through marriage. He left her, and left the money with her, though she was the person he loved most. The rock moved a little more.

The third man: a worker's wages

He had hired workers and paid them all except one, who left without his wage. He invested it until it grew into camels, cows and sheep. Years later the worker came back asking for his pay, and he told him: all of this is yours. The worker thought he was being mocked. He was not, and the worker drove the whole herd away. The rock rolled back completely, and the three walked out (Bukhari 2272; also Sahih Muslim 2743).

📩 Free Ramadan 2027 checklist

Join the weekly AskUmmah email: a sourced dua, 5 quiz questions and the Islamic dates coming up. Confirm your email and get the printable checklist free.

No spam. Unsubscribe anytime. Privacy

What we can take from it

  • Sincere deeds are saved for the day you need them. None of the three had an audience.
  • It is good to ask Allah by your sincere deeds. Scholars cite this hadith for making dua through one’s own good actions.
  • Honour your parents, guard your chastity, pay what you owe. Three ordinary choices, each heavy enough to move a rock.

We retell authentic texts with their sources and leave out details that are not in them. We do not issue rulings; for personal questions, please ask a qualified scholar. Spotted a mistake? Let us know.

💬 Get a daily dua on WhatsApp

More stories

All stories →

Frequently asked questions

Is the story of the three men in the cave authentic?

Yes. The Prophet ﷺ told it; it is in Sahih al-Bukhari 2272 and Sahih Muslim 2743.

What were the three good deeds?

Putting his elderly parents first, leaving a sin for Allah’s sake when he could have done it, and honestly returning a worker’s wages, grown into a whole herd.

Keep exploring