Aws reported,

We were sitting with the Prophet ﷺ as he was relating stories and reminding us, when a man came and whispered something to him. The Prophet ﷺ said, "Take him away and kill him."When the man had turned to leave, the Messenger of Allah ﷺ called him back and asked, "Do you bear witness that there is no god but Allah?"He answered, "Yes."The Prophet ﷺ said, "Go and let him be, for I have only been commanded to fight people until they say, 'There is no god but Allah.' Once they do that, their blood and their wealth become inviolable to me."

Ibn Majah 3929

Sahih

حدثنا أبو بكر بن أبي شيبة حدثنا عبد الله بن بكر السهمي حدثنا حاتم بن أبي صغيرة عن النعمان بن سالم أن عمرو بن أوس أخبره أن

أباه أوسا أخبره قال

إنا لقعود عند النبي ﷺ وهو يقص علينا ويذكرنا إذ أتاه رجل فساره فقال النبي ﷺ اذهبوا به فاقتلوه فلما ولى الرجل دعاه رسول الله ﷺ فقال هل تشهد أن لا إله إلا الله قال نعم قال اذهبوا فخلوا سبيله فإنما أمرت أن أقاتل الناس حتى يقولوا لا إله إلا الله فإذا فعلوا ذلك حرم علي دماؤهم وأموالهم

ابن ماجه 3929صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Ibn Majah
Book
Tribulations
Chapter
Refraining from harming those who say there is no god but Allah
Numbering
Darussalam 3929
Ibn Majah 3929