Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:2:193

Fight them until there is no ˹more˺ fitnah and ˹until˺ worship is ˹acknowledged to be˺ for Allah. But if they cease, then there is to be no aggression except against the oppressors.  

Fight them till there is no sedition, no idolatry, and the religion, all worship, is for God, alone and none are worshipped apart from Him; then if they desist, from idolatry, do not aggress against them. This is indicated by the following words, there shall be no enmity, no aggression through slaying or otherwise, save against evildoers. Those that desist, however, are not evildoers and should not be shown any enmity.
القرآن:٢:١٩٣

وَقَاتِلُوهُمْ حَتَّىٰ لَا تَكُونَ فِتْنَةٌ وَيَكُونَ الدِّينُ لِلَّهِ ۖ فَإِنِ انْتَهَوْا فَلَا عُدْوَانَ إِلَّا عَلَى الظَّالِمِينَ  

{وقاتلوهم حتى لا تكون} توجد {فتنة} شرك {ويكون الدين} العبادة {لله} وحده لا يعبد سواه {فإن انتهوا} عن الشرك فلا تعتدوا عليهم دل على هذا {فلا عدوان} اعتداء بقتل أو غيره {إلا على الظالمين} ومن انتهى فليس بظالم فلا عدوان عليه.

See similar narrations below:

Collected by Qurʾān
quran:8:39

And fight them until there is no fitnah and ˹until˺ the religion, all of it, is for Allah. And if they cease - then indeed, Allah is Seeing of what they do.  

And fight them until sedition, idolatry, is, exists, no more and religion is all for God, alone, none other being worshipped; then if they desist, from unbelief, surely God sees what they do, and will requite them for it.
القرآن:٨:٣٩

وَقَاتِلُوهُمْ حَتَّىٰ لَا تَكُونَ فِتْنَةٌ وَيَكُونَ الدِّينُ كُلُّهُ لِلَّهِ ۚ فَإِنِ انْتَهَوْا فَإِنَّ اللَّهَ بِمَا يَعْمَلُونَ بَصِيرٌ  

{وقاتلوهم حتى لا تكون} توجد {فتنةٌ} شرك {ويكون الدِّين كله لله} وحده ولا يعبد غيره {فإن انتهوا} عن الكفر {فإن الله بما يعملون بصير} فيجازيهم به.