We were with Messenger of Allah ﷺ in a cave when there was revealed to him (the Sura al-Mursalat, i. e. Sura lxxvii.:" By those sent forth to spread goodness" ) and we had just heard (it) from his lips that there appeared before us a snake. He said: Kill it. We hastened to kill it, but it slipped away from us, thereupon Messenger of Allah ﷺ said: Allah saved it from your harm just as he saved you from its evil. (Using translation from Muslim 2234a)
كُنَّا مَعَ النَّبِيِّ ﷺ فِي غَارٍ وَقَدْ أُنْزِلَتْ عَلَيْهِ وَالْمُرْسَلَاتِ عُرْفًا قَالَ فَنَحْنُ نَأْخُذُهَا مِنْ فِيهِ رَطْبَةً إِذْ خَرَجَتْ عَلَيْنَا حَيَّةٌ فَقَالَ اقْتُلُوهَا قَالَ فَابْتَدَرْنَاهَا لِنَقْتُلَهَا فَسَبَقَتْنَا فَقَالَ رَسُولُ اللهِ ﷺ وَقَاهَا اللهُ شَرَّكُمْ كَمَا وَقَاكُمْ شَرَّهَا