Ikrimah narrates from Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both): A man of Banu Sulaym passed by a group of the Companions, and he had his sheep with him. He greeted them with salam. The Companions said: "He only greeted you with salam to protect himself." They seized him, killed him and took his sheep as well. They brought it to the Prophet (peace and blessings be upon him), and Allah Almighty revealed this verse: "O you who believe, when you go forth in the way of Allah, investigate carefully, and do not say to one who greets you with peace, 'You are not a believer,' seeking the goods of the worldly life; for with Allah are abundant spoils. You yourselves were like that before, then Allah conferred His favour upon you, so investigate carefully." [Surah al-Nisa: 94]
Hadith Referenceالسنن الكبرى للبيهقي / كتاب السير / 18267