It was narrated from the Messenger of Allah ﷺ, and he mentioned several hadith, among them that the Messenger of Allah ﷺ said, "One of the prophets stopped to rest beneath a tree, and an ant bit him. He ordered that his belongings be moved out from under it, then he ordered the ants' nest to be burned with fire. So Allah revealed to him, 'Why not just one ant?'"
و حدثنا محمد بن رافع حدثنا عبد الرزاق أخبرنا معمر عن همام بن منبه قال هذا ما
عن رسول الله ﷺ فذكر أحاديث منها وقال رسول الله ﷺ نزل نبي من الأنبياء تحت شجرة فلدغته نملة فأمر بجهازه فأخرج من تحتها وأمر بها فأحرقت في النار قال فأوحى الله إليه فهلا نملة واحدة