A man from the tribe of Banu Sulaym passed by a group of the companions of the Messenger of Allah ﷺ while driving his sheep, and he greeted them with the salam.They said, "He only greeted us to seek protection from us."So they rose against him, killed him, and took his sheep. They then brought the sheep to the Messenger of Allah ﷺ, whereupon Allah the Exalted revealed, "Believers, when you go forth in the cause of Allah, verify matters carefully, and do not say to one who offers you the greeting of peace, 'You are not a believer'" [Nisa 4:94].
حدثنا عبد بن حميد حدثنا عبد العزيز بن أبي رزمة عن إسرائيل عن سماك بن حرب عن عكرمة
مر رجل من بني سليم على نفر من أصحاب رسول الله ﷺ ومعه غنم له فسلم عليهم قالوا ما سلم عليكم إلا ليتعوذ منكم فقاموا فقتلوه وأخذوا غنمه فأتوا بها رسول الله ﷺ فأنزل الله تعالى {يا أيها الذين آمنوا إذا ضربتم في سبيل الله فتبينوا ولا تقولوا لمن ألقى إليكم السلام لست مؤمنا}
Agreed upon. Bukhari narrated it in the Book of Tafsir, chapter, "Do not say to one who greets you with peace, You are not a believer," no. 4591, and Muslim, no. 3025, both from the hadith of Ibn Abbas by this same chain.There is also a report on this subject from Ibn Zayd [Bukhari, no. 4269, 6872, and Muslim, no. 96/158, 159].