Mishkat al-Masabih 122
عَن أبي بن كَعْب فِي قَوْلِ اللَّهِ عَزَّ وَجَلَّ (وَإِذْ أَخَذَ رَبُّكَ مِنْ بَنِي آدَمَ مِنْ ظُهُورهمْ ذرياتهم وأشهدهم على أنفسهم) الْآيَة قَالَ جمعهم فجعلهم أرواحا ثُمَّ صَوَّرَهُمْ فَاسْتَنْطَقَهُمْ فَتَكَلَّمُوا ثُمَّ أَخَذَ عَلَيْهِمُ الْعَهْدَ وَالْمِيثَاقَ وَأَشْهَدَهُمْ عَلَى أَنْفُسِهِمْ أَلَسْتُ بِرَبِّكُمْ قَالَ فَإِنِّي أشهد عَلَيْكُم السَّمَوَات السَّبْعَ وَالْأَرَضِينَ السَّبْعَ وَأُشْهِدُ عَلَيْكُمْ أَبَاكُمْ آدَمَ عَلَيْهِ السَّلَام أَنْ تَقُولُوا يَوْمَ الْقِيَامَةِ لَمْ نَعْلَمْ بِهَذَا اعْلَمُوا أَنَّهُ لَا إِلَهَ غَيْرِي وَلَا رَبَّ غَيْرِي فَلَا تُشْرِكُوا بِي شَيْئا وَإِنِّي سَأُرْسِلُ إِلَيْكُمْ رُسُلِي يُذَكِّرُونَكُمْ عَهْدِي وَمِيثَاقِي وَأُنْزِلُ عَلَيْكُمْ كُتُبِي قَالُوا شَهِدْنَا بِأَنَّكَ رَبُّنَا وَإِلَهُنَا لَا رب لَنَا غَيْرُكَ فَأَقَرُّوا بِذَلِكَ وَرُفِعَ عَلَيْهِمْ آدَمُ يَنْظُرُ إِلَيْهِمْ فَرَأَى الْغَنِيَّ وَالْفَقِيرَ وَحَسَنَ الصُّورَةِ وَدُونَ ذَلِكَ فَقَالَ رَبِّ لَوْلَا سَوَّيْتَ بَيْنَ عِبَادِكَ قَالَ إِنِّي أَحْبَبْتُ أَنْ أَشْكُرَ وَرَأَى الْأَنْبِيَاءَ فِيهِمْ مِثْلَ السُّرُجِ عَلَيْهِمُ النُّورُ خُصُّوا بِمِيثَاقٍ آخَرَ فِي الرِّسَالَةِ وَالنُّبُوَّةِ وَهُوَ قَوْلُهُ تَعَالَى (وَإِذ أَخذنَا من النَّبِيين ميثاقهم) إِلَى قَوْله (عِيسَى ابْن مَرْيَم) كَانَ فِي تِلْكَ الْأَرْوَاحِ فَأَرْسَلَهُ إِلَى مَرْيَمَ فَحُدِّثَ عَنْ أُبَيٍّ أَنَّهُ دَخَلَ مِنْ فِيهَا. رَوَاهُ أَحْمد
From Ubayy ibn Kaʿb, about the saying of Allah, Mighty and Majestic: 'And when your Lord took from the children of Adam, from their backs, their offspring, and made them testify about themselves' (the verse). He said: He gathered them and made them spirits, then gave them form and made them speak, and they spoke. Then He took from them the pledge and the covenant and made them testify about themselves: "Am I not your Lord?" He said: "I call the seven heavens and the seven earths to witness against you, and I call your father Adam, peace be upon him, to witness against you, lest you say on the Day of Resurrection: 'We did not know of this.' Know that there is no god other than Me and no lord other than Me, so do not associate anything with Me. I will send you My messengers to remind you of My pledge and My covenant, and I will send down to you My Books." They said: "We testify that You are our Lord and our God; we have no lord other than You." So they affirmed that. Adam was raised above them, looking at them, and he saw the rich and the poor, the handsome and those less so. He said: "My Lord, why did You not make Your slaves equal?" He said: "I loved to be thanked." And he saw the prophets among them like lamps, with light upon them. They were singled out with another covenant concerning the message and prophethood, which is His saying, the Exalted: 'And when We took from the prophets their covenant' up to His saying: 'ʿIsa son of Maryam'. He was among those spirits, and He sent him to Maryam. And it was narrated from Ubayy that he entered through her mouth. Reported by Ahmad.