Aws bin Abu Aws reported,

We were sitting with the Messenger of Allah ﷺ in the Suffah while he was relating stories to us and reminding us, when a man came and whispered something to him.The Messenger of Allah ﷺ said, "Go and kill him."When the man turned to leave, the Messenger of Allah ﷺ called him back and asked, "Does he testify that there is no god but Allah?"The man replied, "Yes, Messenger of Allah."He said, "Go and let him go free, for I have only been commanded to fight people until they testify that there is no god but Allah. Once they do that, their blood and property become inviolable to me, except by its rightful claim."

Azami 7865

Sahih

عن أوس بن أبي أوس الثقفي قال

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

الأعظمي 7865صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Jihad
Chapter
Rulings on jihad and its etiquette
Section
Command to fight the warring enemies until they say, "There is no god but Allah"
Numbering
Jami al-Kamil 7865 (2nd edition)
Azami 7865