A man from the tribe of Banu Sulaym passed by a group of the companions of the Prophet ﷺ while driving a flock of sheep. He greeted them with the salaam, but they said, "He only greeted us to seek protection from us." So they set upon him, killed him, and seized his sheep. They then brought the sheep to the Prophet ﷺ, and Allah revealed, "You who believe, when you go out in the cause of Allah, verify carefully, and do not say to the one who offers you the greeting of peace, 'You are not a believer'" [Nisa 4:94] to the end of the verse.
حدثنا حسين بن محمد وخلف بن الوليد قالا حدثنا إسرائيل عن سماك عن عكرمة
مر رجل من بني سليم على نفر من أصحاب النبي ﷺ وهو يسوق غنما له فسلم عليهم فقالوا ما سلم عليكم إلا ليتعوذ منكم فعمدوا إليه فقتلوه وأخذوا غنمه فأتوا بها النبي ﷺ فأنزل الله عز وجل {يا أيها الذين آمنوا إذا ضربتم في سبيل الله فتبينوا ولا تقولوا لمن ألقى إليكم السلام لست مؤمنا} إلى آخر الآية