عن عبد الله بن عمر رضي الله عنهما قال سمعت رسول الله صلى الله عليه وسلم يقول انطلق ثلاثة نفر ممن كان قبلكم حتى آواهم المبيت إلى غار فدخلوه فانحدرت صخرة من الجبل فسدت عليهم الغار فقالوا إنه لا ينجيكم من هذه الصخرة إلا أن تدعوا الله بصالح أعمالكم فقال رجل منهم اللهم كان لي أبوان شيخان كبيران وكنت لا أغبق قبلهما أهلا ولا مالا فنأى بي في طلب شجر يوما فلم أرح عليهما حتى ناما فحلبت لهما غبوقهما فوجدتهما نائمين وكرهت أن أغبق قبلهما أهلا أو مالا فلبثت والقدح على يدي أنتظر استيقاظهما حتى برق الفجر- زاد بعض الرواة (والصبية يتضاغون عند قدميّ) فاستيقظا فشربا غبوقهما اللهم إن كنت فعلت ذلك ابتغاء وجهك ففرج عنا ما نحن فيه من هذه الصخرة فانفرجت شيئا لا يستطيعون الخروج قال النبي صلى الله عليه وسلم وقال الآخر اللهم كانت لي ابنة عم كانت أحب الناس إلي فأردتها عن نفسها فامتنعت مني حتى ألمت بها سنة من السنين فجاءتني فأعطيتها عشرين ومائة دينار على أن تخلي بيني وبين نفسها ففعلت حتى إذا قدرت عليها قالت لا أحل لك أن تفض الخاتم إلا بحقه فتحرجت من الوقوع عليها فانصرفت عنها وهي أحب الناس إلي وتركت الذهب الذي أعطيتها اللهم إن كنت فعلت ابتغاء وجهك فافرج عنا ما نحن فيه فانفرجت الصخرة غير أنهم لا يستطيعون الخروج منها قال النبي صلى الله عليه وسلم وقال الثالث اللهم (إني) استأجرت أجراء و أعطيتهم أجرهم غير رجل واحد ترك الذي له وذهب فثمرت أجره حتى كثرت منه الأموال فجاءني بعد حين فقال يا عبد الله أد إلي أجري فقلت له كل ما ترى من أجرك من الإبل والبقر والغنم والرقيق فقال يا عبد الله لا تستهزئ بي فقلت إني لا أستهزئ بك فأخذه كله فاستاقه فلم يترك منه شيئا اللهم فإن كنت فعلت ذلك ابتغاء وجهك فافرج عنا ما نحن فيه فانفرجت الصخرة فخرجوا يمشون (الترغيب و الترهيب 1/55)
Hadhrat ibn Umar (Radhiyallahu Anhuma) reports that Rasulullah (Sallallahu Alayhi Wasallam) said: There were three people from the nations before you, who were once travelling on a journey when they had taken shelter in a cave (due to being overtaken by a storm). Suddenly, a rock fell from the mountain and blocked the exit of the cave.
One of them said: “The only way to gain freedom from this predicament is to beseech Allah Ta’ala via some virtuous deed that was committed.” Thereupon one of them supplicated, “O Allah, my parents were very old. I used to offer them milk at night before my children and the other members of the family. One day I travelled far in search of (grass for the animals) and only returned after my parent had gone to sleep. When I had milked the animals and brought the milk to them, they were already fast asleep. I did not wish to disturb them, nor did I wish to give any part of the milk to my children and other members of the family before I served my parents. Thus, with the vessel in my hand, I awaited their awakening till the time of dawn set in, while the children cried out of hunger at my feet. When my parents awoke, I first served them the milk (and then served my family and children). O Allah, if I carried out this action solely for Your pleasure, then do relieve us of this distress.” Thereupon, the rock moved a little but not enough to allow them to come out.
Then the second man supplicated: “O Allah, I had a cousin whom I loved the most. I tried to seduce her but she always refused, until a time came when she was in great difficulty and was going through poverty. She approached me (for financial assistance and help) and I gave her one hundred and twenty dinars on condition that she would allow me to have relations with her. She (initially) agreed, and when we were together and I was in privacy with her, she pleaded: ‘I don’t allow you to open the seal (i.e. to have relations with me) except in the lawful manner (i.e. it is only permissible for my husband)’. I thus moved away from her, despite the fact that I desired her most passionately; and I let her keep the money I had given her. O Allah, if I carried out this action solely for Your pleasure, then do relieve us of this distress.” Thereupon, the rock again moved a little but not enough to allow them to come out.
Then the third person supplicated: “O Allah, I hired some laborers and paid them their dues, but one of them left without taking what was due to him. I invested it and it prospered greatly. After a while the labourer returned and said: ‘O servant of Allah, hand over to me my wages.’ I said to him: ‘All that you see is yours – camels, cattle, goats and slaves.’ He said: ‘O servant of Allah, do not joke with me.’ I assured him that I was not joking with him. So he took all of it leaving nothing behind. O Allah, if I carried out this action solely for Your pleasure, then do relieve us of our distress.”
The rock then moved away, and all three left the cave walking.”