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:191

And kill them wherever you overtake them and expel them from wherever they have expelled you, and fitnah is worse than killing. And do not fight them at al-Masjid al- Haram until they fight you there. But if they fight you, then kill them. Such is the recompense of the disbelievers.  

And slay them wherever you come upon them, and expel them from where they expelled you, that is, from Mecca, and this was done after the Conquest of Mecca; sedition, their idolatry, is more grievous, more serious, than slaying, them in the Sacred Enclosure or while in a state of pilgrimage inviolability, the thing that you greatly feared. But fight them not by the Sacred Mosque, that is, in the Sacred Enclosure, until they should fight you there; then if they fight you, there, slay them, there (a variant reading drops the alif in the three verbs ˹sc. wa-lā taqtilūhum, hattā yaqtulūkum, fa-in qatalūkum, so that the sense is ‘slaying’ in all three, and not just ‘fighting’˺) — such, killing and expulsion, is the requital of disbelievers.
القرآن:٢:١٩١

وَاقْتُلُوهُمْ حَيْثُ ثَقِفْتُمُوهُمْ وَأَخْرِجُوهُمْ مِنْ حَيْثُ أَخْرَجُوكُمْ ۚ وَالْفِتْنَةُ أَشَدُّ مِنَ الْقَتْلِ ۚ وَلَا تُقَاتِلُوهُمْ عِنْدَ الْمَسْجِدِ الْحَرَامِ حَتَّىٰ يُقَاتِلُوكُمْ فِيهِ ۖ فَإِنْ قَاتَلُوكُمْ فَاقْتُلُوهُمْ ۗ كَذَٰلِكَ جَزَاءُ الْكَافِرِينَ  

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