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:22:60

That ˹is so˺. And whoever responds ˹to injustice˺ with the equivalent of that with which he was harmed and then is tyrannized - Allah will surely aid him. Indeed, Allah is Pardoning and Forgiving.  

That, which We have related to you, ˹is so˺. And whoever retaliates, ˹whoever˺ from among the believers requites, with the like of what he was made to suffer, at the hands of the idolaters wrongfully: that is whoever fights against them if they fight against him during the sacred month, and then is ˹again˺ made to suffer aggression, by them, that is to say, he is ˹again˺ wronged, by being expelled from his house, God will surely help him. Indeed God is Pardoning, to believers, Forgiving, them their engaging in combat during the sacred month.
القرآن:٢٢:٦٠

ذَٰلِكَ وَمَنْ عَاقَبَ بِمِثْلِ مَا عُوقِبَ بِهِ ثُمَّ بُغِيَ عَلَيْهِ لَيَنْصُرَنَّهُ اللَّهُ ۗ إِنَّ اللَّهَ لَعَفُوٌّ غَفُورٌ  

الأمر {ذلك} الذي قصصناه عليك {ومن عاقب} جازي من المؤمنين {بمثل ما عوقب به} ظلما من المشركين: أي قاتلهم كما قاتلوه في الشهر الحرام {ثم بغي عليه} منهم أي ظلم بإخراجه من منزله {لينصرنه الله إن الله لعفوٌ} عن المؤمنين {غفور} لهم عن قتالهم في الشهر الحرام.