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:8:38

Say to those who have disbelieved ˹that˺ if they cease, what has previously occurred will be forgiven for them. But if they return ˹to hostility˺ - then the precedent of the former ˹rebellious˺ peoples has already taken place.  

Say to the disbelievers, such as Abū Sufyān and his companions, that if they desist, from unbelief and from waging war against the Prophet (s), that which is past, of their deeds, will be forgiven them; but if they return, to waging war against him, the way of ˹dealing with˺ the ancients has already gone before!, that is, Our way ˹in dealing˺ with them, by destroying them: We will do the same with these ones.
القرآن:٨:٣٨

قُلْ لِلَّذِينَ كَفَرُوا إِنْ يَنْتَهُوا يُغْفَرْ لَهُمْ مَا قَدْ سَلَفَ وَإِنْ يَعُودُوا فَقَدْ مَضَتْ سُنَّتُ الْأَوَّلِينَ  

{قل للذين كفروا} كأبي سفيان وأصحابه {إن ينتهوا} عن الكفر وقتال النبي ﷺ {يُغفر لهم ما قد سلف} من أعمالهم {وإن يعودوا} إلى قتال {فقد مضت سنَّةُ الأولين} أي سنتنا فيهم بالإهلاك فكذا نفعل بهم.