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 there is no god but Allah, their blood and wealth are protected from me, except for what is rightfully due, and their reckoning rests with Allah."
حدثنا سويد بن سعيد حدثنا علي بن مسهر عن الأعمش عن أبي سفيان
قال رسول الله ﷺ أمرت أن أقاتل الناس حتى يقولوا لا إله إلا الله فإذا قالوا لا إله إلا الله عصموا مني دماءهم وأموالهم إلا بحقها وحسابهم على الله
Muslim also narrated it, no. 35/21, from the hadith of Amash, through this same chain.