While we were with the Prophet ﷺ in a cave at Mina, the revelation came down to him, "By those sent forth in succession" [Mursalat 77:1]. He was reciting it, and I was receiving it directly from his mouth, his mouth still moist with it, when suddenly a snake leapt out at us.The Prophet ﷺ said, "Kill it!"We rushed at it, but it escaped.The Prophet ﷺ then said, "It has been spared your harm just as you have been spared its harm."
بينما نحن مع النبي ﷺ في غار بمنى إذ نزل عليه: {والمرسلت عرفا} [سورة المرسلات: ١] وإنه ليتلوها وإني لأتلقاها من فيه وإن فاه لرطب بها إذ وثبت علينا حية فقال النبي ﷺ: اقتلوها، فابتدرناها فذهبت، فقال النبي ﷺ: وقيت شركم كما وقيتم شرها.
Narrated by Bukhari in the chapter on the penalty for hunting (1830), and by Muslim in the chapter on greetings (2234), both through the route of Amash, who said, "Ibrahim (that is, Nakhai) told me, from Aswad (that is, Ibn Yazid Nakhai), from Ibn Masud," with this wording. The wording given is Bukhari's, and Muslim's wording is similar, except that his version does not include "in Mina."Bukhari added afterward, "We only meant by this that Mina is part of the Haram, and that they saw no harm in killing the snake."