The Jews used to say, whenever a young child of theirs died, "He is a righteous one." Word of this reached the Prophet ﷺ, and he said, "The Jews have lied. There is no soul that Allah creates in the womb of its mother except that it is either wretched or blessed."So Allah the Exalted revealed at that time this verse, "He is most knowing of you when He produced you from the earth and when you were fetuses in the wombs of your mothers. So do not claim purity for yourselves. He is most knowing of those who fear Him" [Najm 53:32].
كانت اليهود تقول إذا هلك لهم صبي صغير: هو صديق، فبلغ ذلك النبي ﷺ فقال: كذبت يهود، ما من نسمة يخلقها الله في بطن أمه إلا شقي أو سعيد فأنزل الله تعالى عند ذلك هذه الآية: {هو أعلم بكم إذ أنشأكم من الأرض وإذ أنتم أجنة في بطون أمهاتكم فلا تزكوا أنفسكم هو أعلم بمن اتقى}
No references are available.
Tabarani reported it in Al-Kabir (2/75) via Yahya bin Bukayr, and Wahidi reported it in Asbab al-Nuzul (p. 422) via Ibn Wahb, both of them (Yahya bin Bukayr and Ibn Wahb) from Ibn Lahia, from Harith bin Yazid, from Thabit bin Harith Ansari, who said, then he related it.Its chain is hasan, on account of Ibn Lahia, about whom there is well known discussion, but the narration of Ibn Wahb from him is more reliable than others, for he was among his earliest companions, and he narrated from him before his mixing up occurred.