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:9:5

And when the sacred months have passed, then kill the polytheists wherever you find them and capture them and besiege them and sit in wait for them at every place of ambush. But if they should repent, establish prayer, and give zakah, let them ˹go˺ on their way. Indeed, Allah is Forgiving and Merciful.  

Then, when the sacred months have passed — that is, ˹at˺ the end of the period of deferment — slay the idolaters wherever you find them, be it during a lawful ˹period˺ or a sacred ˹one˺, and take them, captive, and confine them, to castles and forts, until they have no choice except ˹being put to˺ death or ˹acceptance of˺ Islam; and lie in wait for them at every place of ambush, ˹at every˺ route that they use (kulla, ‘every’, is in the accusative because a ˹preceding˺ genitive-taking preposition has been removed). But if they repent, of unbelief, and establish prayer and pay the alms, then leave their way free, and do not interfere with them. God is Forgiving, Merciful, to those who repent.
القرآن:٩:٥

فَإِذَا انْسَلَخَ الْأَشْهُرُ الْحُرُمُ فَاقْتُلُوا الْمُشْرِكِينَ حَيْثُ وَجَدْتُمُوهُمْ وَخُذُوهُمْ وَاحْصُرُوهُمْ وَاقْعُدُوا لَهُمْ كُلَّ مَرْصَدٍ ۚ فَإِنْ تَابُوا وَأَقَامُوا الصَّلَاةَ وَآتَوُا الزَّكَاةَ فَخَلُّوا سَبِيلَهُمْ ۚ إِنَّ اللَّهَ غَفُورٌ رَحِيمٌ  

{فإذا انسلخ} خرج {الأشهر الحرم} وهي آخر مدة التأجيل {فاقتلوا المشركين حيث وجدتموهم} في حل أو حرم {وخذوهم} بالأسر {واحصروهم} في القلاع والحصون حتى يضطروا إلى القتل أو الإسلام {واقعدوا لهم كلَّ مرصد} طريق يسلكونه ونصب كل على نزع الخافض {فإن تابوا} من الكفر {وأقاموا الصلاة وآتوا الزكاة فخلُّوا سبيلهم} ولا تتعرضوا لهم {إن الله غفور رحيم} لمن تاب.