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:4:89

They wish you would disbelieve as they disbelieved so you would be alike. So do not take from among them allies until they emigrate for the cause of Allah. But if they turn away, then seize them and kill them wherever you find them and take not from among them any ally or helper.  

They long, they wish, that you should disbelieve as they disbelieve, so then you, and they, would be equal, in unbelief; therefore do not take friends from among them, associating with them, even if they should ˹outwardly˺ manifest belief, until they emigrate in the way of God, a proper emigration that would confirm their belief; then, if they turn away, and remain upon their ways, take them, as captives, and slay them wherever you find them; and do not take any of them as a patron, to associate with, or as a helper, to assist you against your enemy.
القرآن:٤:٨٩

وَدُّوا لَوْ تَكْفُرُونَ كَمَا كَفَرُوا فَتَكُونُونَ سَوَاءً ۖ فَلَا تَتَّخِذُوا مِنْهُمْ أَوْلِيَاءَ حَتَّىٰ يُهَاجِرُوا فِي سَبِيلِ اللَّهِ ۚ فَإِنْ تَوَلَّوْا فَخُذُوهُمْ وَاقْتُلُوهُمْ حَيْثُ وَجَدْتُمُوهُمْ ۖ وَلَا تَتَّخِذُوا مِنْهُمْ وَلِيًّا وَلَا نَصِيرًا  

{ودُّوا} تمنوا {لو تكفرون كما كفروا فتكونون} أنتم وهم {سواء} في الكفر {فلا تتخذوا منهم أولياء} توالونهم وإن أظهروا الإيمان {حتى يهاجروا في سبيل الله} هجرة صحيحة تحقق إيمانهم {فإن تَوَلَّوْا} وأقاموا على ما هم عليه {فخذوهم} بالأسر {واقتلوهم حيث وجدتموهم ولا تتخذوا منهم وليا} توالونه {ولا نصيرا} تنتصرون به على عدوكم.