وَحَدَّثَنِي يَحْيَى، عَنْ مَالِكٍ، عَنْ زَيْدِ بْنِ أَبِي أُنَيْسَةَ، عَنْ عَبْدِ الْحَمِيدِ بْنِ عَبْدِ الرَّحْمَنِ بْنِ زَيْدِ بْنِ الْخَطَّابِ، أَنَّهُ أَخْبَرَهُ عَنْ مُسْلِمِ بْنِ يَسَارٍ الْجُهَنِيِّ، أَنَّ عُمَرَ بْنَ الْخَطَّابِ، سُئِلَ عَنْ هَذِهِ الآيَةِ، ‏{‏وَإِذْ أَخَذَ رَبُّكَ مِنْ بَنِي آدَمَ مِنْ ظُهُورِهِمْ ذُرِّيَّتَهُمْ وَأَشْهَدَهُمْ عَلَى أَنْفُسِهِمْ أَلَسْتُ بِرَبِّكُمْ قَالُوا بَلَى شَهِدْنَا أَنْ تَقُولُوا يَوْمَ الْقِيَامَةِ إِنَّا كُنَّا عَنْ هَذَا غَافِلِينَ‏}‏ ‏.‏ فَقَالَ عُمَرُ بْنُ الْخَطَّابِ سَمِعْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم يُسْأَلُ عَنْهَا فَقَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ إِنَّ اللَّهَ تَبَارَكَ وَتَعَالَى خَلَقَ آدَمَ ثُمَّ مَسَحَ ظَهْرَهُ بِيَمِينِهِ فَاسْتَخْرَجَ مِنْهُ ذُرِّيَّةً فَقَالَ خَلَقْتُ هَؤُلاَءِ لِلْجَنَّةِ وَبِعَمَلِ أَهْلِ الْجَنَّةِ يَعْمَلُونَ ثُمَّ مَسَحَ ظَهْرَهُ فَاسْتَخْرَجَ مِنْهُ ذُرِّيَّةً فَقَالَ خَلَقْتُ هَؤُلاَءِ لِلنَّارِ وَبِعَمَلِ أَهْلِ النَّارِ يَعْمَلُونَ ‏"‏ ‏.‏ فَقَالَ رَجُلٌ يَا رَسُولَ اللَّهِ فَفِيمَ الْعَمَلُ قَالَ فَقَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ إِنَّ اللَّهَ إِذَا خَلَقَ الْعَبْدَ لِلْجَنَّةِ اسْتَعْمَلَهُ بِعَمَلِ أَهْلِ الْجَنَّةِ حَتَّى يَمُوتَ عَلَى عَمَلٍ مِنْ أَعْمَالِ أَهْلِ الْجَنَّةِ فَيُدْخِلَهُ بِهِ الْجَنَّةَ وَإِذَا خَلَقَ الْعَبْدَ لِلنَّارِ اسْتَعْمَلَهُ بِعَمَلِ أَهْلِ النَّارِ حَتَّى يَمُوتَ عَلَى عَمَلٍ مِنْ أَعْمَالِ أَهْلِ النَّارِ فَيُدْخِلَهُ بِهِ النَّارَ ‏"‏ ‏.‏

Yahya related to me from Malik from Zayd ibn Abi Unaysa that Abdal-Hamid ibn Abd ar-Rahman ibn Zayd ibn al-Khattab informed him fromMuslim ibn Yasar al-Juhani that Umar ibn al-Khattab was asked aboutthis ayat - "When your Lord took their progeny from the Banu Adam fromtheir backs and made them testify against themselves. 'Am I not yourLord?' They said, 'Yes, we bear witness' Lest you should sayon the Day of Rising, 'We were heedless of that.'" (Sura 7 ayat 172)Umar ibn al-Khattab said, "I heard the Messenger of Allah, may Allahbless him and grant him peace, being asked about it. The Messenger ofAllah, may Allah bless him and grant him peace, said, 'Allah, theBlessed, the Exalted, created Adam. Then He stroked his back with Hisright hand, and progeny issued from it. He said, "I created these forthe Garden and they will act with the behaviour of the people of theGarden." Then He stroked his back again and brought forth progeny fromhim. He said, "I created these for the Fire and they will act with thebehaviour of the people of the Fire." 'A man said, 'Messenger ofAllah! Then of what value are deeds?' The Messenger of Allah, mayAllah bless him and grant him peace, answered, 'When Allah creates aslave for the Garden, he makes him use the behaviour of the people ofthe Garden, so that he dies on one of the actions of the people of theGarden and by it He brings him into the Garden. When He creates aslave for the Fire, He makes him use the behaviour of the people ofthe Fire, so that he dies on one of the actions of the people of theFire, and by it, He brings him into the Fire.' " Translation Not Available

Book reference: Muwatta Imam Malik Book 46 Hadith 1627
Web reference: Muwatta Imam Malik Book 46 Hadith 2