The Messenger of Allah ﷺ said, "I have been commanded to fight the people until they say there is no god but Allah. Once they say it, they have protected their lives and property from me, except for what is rightfully due, and their reckoning is with Allah."
أخبرنا إسحق بن إبراهيم قال أنبأنا يعلى بن عبيد عن الأعمش عن أبي سفيان عن جابر وعن أبي صالح
قال رسول الله ﷺ أمرت أن أقاتل الناس حتى يقولوا لا إله إلا الله فإذا قالوها منعوا مني دماءهم وأموالهم إلا بحقها وحسابهم على الله
Muslim narrated it through Amash by this same chain (see the preceding hadith), and it also appears in Kubra, hadith no. 3439.