كتاب القدر
46  
The Book of Destiny
(1)
Chapter: How The Human Being Is Created, In His Mother's Womb, And His Provision, Lifespan And Deeds Are Written Down, And His Misery and Happiness
(1)
بَاب كَيْفِيَّةِ خَلْقِ الْآدَمِيِّ فِي بَطْنِ أُمِّهِ وَكِتَابَةِ رِزْقِهِ وَأَجَلِهِ وَعَمَلِهِ وَشَقَاوَتِهِ وَسَعَادَتِهِ
Sahih Muslim 2650

Abu al-Aswad reported that 'Imran b Husain asked him:

What is your view, what the people do today in the world, and strive for, is it something decreed for them or preordained for them or will their fate in the Hereafter be deterrained by the fact that their Prophets brought them teaching which they did not act upon? I said: Of course, it is something which is predetermined for them and preordained for them. He (further) said: Then, would it not be an injustice (to punish them)? I felt greatly disturbed because of that, and said: Everything is created by Allah and lies in His Power. He would not be questioned as to what He does, but they would be questioned; thereupon he said to me: May Allah have mercy upon you, I did not mean to ask you but for testing your intelligence. Two men of the tribe of Muzaina came to Allah's Messenger (ﷺ) and said: Allah's Messenger, what is your opinion that the people do in the world and strive for, is something decreed for them; something preordained for them and will their fate in the Hereafter be determined by the fact that their Prophets brought them teachings which they did not act upon. and thus they became deserving of punishment? Thereupon, he said: Of course, it happens as it is decreed by Destiny and preordained for them, and this view is confirmed by this verse of the Book of Allah, the Exalted and Glorious:" Consider the soul and Him Who made it perfect, then breathed into it its sin and its piety" (xci. 8).
حَدَّثَنَا إِسْحَاقُ بْنُ إِبْرَاهِيمَ الْحَنْظَلِيُّ، حَدَّثَنَا عُثْمَانُ بْنُ عُمَرَ، حَدَّثَنَا عَزْرَةُ بْنُ، ثَابِتٍ عَنْ يَحْيَى بْنِ عُقَيْلٍ، عَنْ يَحْيَى بْنِ يَعْمُرَ، عَنْ أَبِي الأَسْوَدِ الدِّئَلِيِّ، قَالَ قَالَ لِي عِمْرَانُ بْنُ الْحُصَيْنِ أَرَأَيْتَ مَا يَعْمَلُ النَّاسُ الْيَوْمَ وَيَكْدَحُونَ فِيهِ أَشَىْءٌ قُضِيَ عَلَيْهِمْ وَمَضَى عَلَيْهِمْ مِنْ قَدَرِ مَا سَبَقَ أَوْ فِيمَا يُسْتَقْبَلُونَ بِهِ مِمَّا أَتَاهُمْ بِهِ نَبِيُّهُمْ وَثَبَتَتِ الْحُجَّةُ عَلَيْهِمْ فَقُلْتُ بَلْ شَىْءٌ قُضِيَ عَلَيْهِمْ وَمَضَى عَلَيْهِمْ قَالَ فَقَالَ أَفَلاَ يَكُونُ ظُلْمًا قَالَ فَفَزِعْتُ مِنْ ذَلِكَ فَزَعًا شَدِيدًا وَقُلْتُ كُلُّ شَىْءٍ خَلْقُ اللَّهِ وَمِلْكُ يَدِهِ فَلاَ يُسْأَلُ عَمَّا يَفْعَلُ وَهُمْ يُسْأَلُونَ ‏.‏ فَقَالَ لِي يَرْحَمُكَ اللَّهُ إِنِّي لَمْ أُرِدْ بِمَا سَأَلْتُكَ إِلاَّ لأَحْزُرَ عَقْلَكَ إِنَّ رَجُلَيْنِ مِنْ مُزَيْنَةَ أَتَيَا رَسُولَ اللَّهِ صلى الله عليه وسلم فَقَالاَ يَا رَسُولَ اللَّهِ أَرَأَيْتَ مَا يَعْمَلُ النَّاسُ الْيَوْمَ وَيَكْدَحُونَ فِيهِ أَشَىْءٌ قُضِيَ عَلَيْهِمْ وَمَضَى فِيهِمْ مِنْ قَدَرٍ قَدْ سَبَقَ أَوْ فِيمَا يُسْتَقْبَلُونَ بِهِ مِمَّا أَتَاهُمْ بِهِ نَبِيُّهُمْ وَثَبَتَتِ الْحُجَّةُ عَلَيْهِمْ فَقَالَ ‏"‏ لاَ بَلْ شَىْءٌ قُضِيَ عَلَيْهِمْ وَمَضَى فِيهِمْ وَتَصْدِيقُ ذَلِكَ فِي كِتَابِ اللَّهِ عَزَّ وَجَلَّ ‏{‏ وَنَفْسٍ وَمَا سَوَّاهَا * فَأَلْهَمَهَا فُجُورَهَا وَتَقْوَاهَا‏}‏ ‏"‏ ‏.‏
Reference : Sahih Muslim 2650
In-book reference : Book 46, Hadith 17
USC-MSA web (English) reference : Book 33, Hadith 6406
  (deprecated numbering scheme)