Sahih al-Bukhari, Hadith 6594 ⓘ
Narrated `Abdullah: Allah's Messenger, the truthful and truly-inspired, said, "Each one of you collected in the womb of his mother for forty days, and then turns into a clot for an equal period (of forty days) and turns into a piece of flesh for a similar period (of forty days) and then Allah sends an angel and orders him to write four things, i.e., his provision, his age, and whether he will be of the wretched or the blessed (in the Hereafter). Then the soul is breathed into him. And by Allah, a person among you (or a man) may do deeds of the people of the Fire till there is only a cubit or an arm-breadth distance between him and the Fire, but then that writing (which Allah has ordered the angel to write) precedes, and he does the deeds of the people of Paradise and enters it; and a man may do the deeds of the people of Paradise till there is only a cubit or two between him and Paradise, and then that writing precedes and he does the deeds of the people of the Fire and enters it."
حَدَّثَنَا أَبُو الْوَلِيدِ، هِشَامُ بْنُ عَبْدِ الْمَلِكِ حَدَّثَنَا شُعْبَةُ، أَنْبَأَنِي سُلَيْمَانُ الأَعْمَشُ، قَالَ سَمِعْتُ زَيْدَ بْنَ وَهْبٍ، عَنْ عَبْدِ اللَّهِ، قَالَ حَدَّثَنَا رَسُولُ اللَّهِ صلى الله عليه وسلم وَهْوَ الصَّادِقُ الْمَصْدُوقُ قَالَ " إِنَّ أَحَدَكُمْ يُجْمَعُ فِي بَطْنِ أُمِّهِ أَرْبَعِينَ يَوْمًا، ثُمَّ عَلَقَةً مِثْلَ ذَلِكَ، ثُمَّ يَكُونُ مُضْغَةً مِثْلَ ذَلِكَ، ثُمَّ يَبْعَثُ اللَّهُ مَلَكًا فَيُؤْمَرُ بِأَرْبَعٍ بِرِزْقِهِ، وَأَجَلِهِ، وَشَقِيٌّ، أَوْ سَعِيدٌ، فَوَاللَّهِ إِنَّ أَحَدَكُمْ ـ أَوِ الرَّجُلَ ـ يَعْمَلُ بِعَمَلِ أَهْلِ النَّارِ، حَتَّى مَا يَكُونُ بَيْنَهُ وَبَيْنَهَا غَيْرُ بَاعٍ أَوْ ذِرَاعٍ، فَيَسْبِقُ عَلَيْهِ الْكِتَابُ، فَيَعْمَلُ بِعَمَلِ أَهْلِ الْجَنَّةِ، فَيَدْخُلُهَا، وَإِنَّ الرَّجُلَ لَيَعْمَلُ بِعَمَلِ أَهْلِ الْجَنَّةِ، حَتَّى مَا يَكُونُ بَيْنَهُ وَبَيْنَهَا غَيْرُ ذِرَاعٍ أَوْ ذِرَاعَيْنِ، فَيَسْبِقُ عَلَيْهِ الْكِتَابُ، فَيَعْمَلُ بِعَمَلِ أَهْلِ النَّارِ، فَيَدْخُلُهَا " . قَالَ آدَمُ إِلاَّ ذِرَاعٌ.
also referenced under: Book 82, Hadith 1 (In-Book) & Volume 8, Book 77, Hadith 593 (USC-MSA)