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

O you who have believed, be persistently standing firm for Allah, witnesses in justice, and do not let the hatred of a people prevent you from being just. Be just; that is nearer to righteousness. And fear Allah; indeed, Allah is Acquainted with what you do.  

O you who believe, be upright before God, in ˹fulfilling˺ what is His due, witnesses in equity, in justice. Let not hatred of a people, namely, the disbelievers, cause you not to be just, and to harm them on account of their enmity; be just, towards both friend and foe, that, justice, is nearer to God-fearing. And fear God; surely God is aware of what you do, and will requite you for it.
القرآن:٥:٨

يَا أَيُّهَا الَّذِينَ آمَنُوا كُونُوا قَوَّامِينَ لِلَّهِ شُهَدَاءَ بِالْقِسْطِ ۖ وَلَا يَجْرِمَنَّكُمْ شَنَآنُ قَوْمٍ عَلَىٰ أَلَّا تَعْدِلُوا ۚ اعْدِلُوا هُوَ أَقْرَبُ لِلتَّقْوَىٰ ۖ وَاتَّقُوا اللَّهَ ۚ إِنَّ اللَّهَ خَبِيرٌ بِمَا تَعْمَلُونَ  

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