Suuratul Maidah Verse 8.
يَـٰٓأَيُّهَا ٱلَّذِينَ ءَامَنُوا۟ كُونُوا۟ قَوَّٰمِينَ لِلَّـهِ شُهَدَآءَ بِٱلْقِسْطِ ۖ وَلَا يَجْرِمَنَّكُمْ شَنَـَٔانُ قَوْمٍ عَلَىٰٓ أَلَّا تَعْدِلُوا۟
ۚٱعْدِلُوا۟ هُوَ أَقْرَبُ لِلتَّقْوَىٰ ۖ وَٱتَّقُوا۟ ٱللَّـهَ ۚ إِنَّ ٱللَّـهَ خَبِيرٌۢ بِمَا تَعْمَلُونَ ﴿٨
8. O you who believe! Stand out firmly for Allah and be just witnesses and let not the enmity and hatred of others make you avoid justice. Be just: that is nearer to piety, and fear Allah. Verily, Allah is Well-Acquainted with what you do.
Tafsir Ibn Kathir Vol. 3, Page 122.
يَـأَيُّهَآ الَّذِينَ ءَامَنُواْ كُونُواْ قَوَّامِينَ للَّهِ
(O you who believe! Stand out firmly for Allah…) meaning, in truth for the sake of Allah, not for the sake of people or for fame,
(as just witnesses) observing justice and not transgression. It is recorded in the Two Sahihs that An-Nu`man bin Bashir said, “My father gave me a gift, but `Amrah bint Rawahah, my mother, said that she would not agree to it unless he made Allah’s Messenger as a witness to it. So, my father went to Allah’s Messenger to ask him to be a witness to his giving me the gift. Allah’s Messenger asked,
«أكل ولدك نحلت مثله؟»
(`Have you given the like of it to everyone of your offspring’) He replied in the negative. Allah’s Messenger said,
«اتَّقُوا اللهَ وَاعْدِلُوا فِي أَوْلَادِكُم»
(Have Taqwa of Allah and treat your children equally.) And said;
«إِنِّي لَا أَشْهَدُ عَلى جَوْر»
(I shall not be witness to injustice.) My father then returned and took back his gift.” Allah said;
وَلاَ يَجْرِمَنَّكُمْ شَنَآنُ قَوْمٍ عَلَى أَلاَّ تَعْدِلُواْ
(and let not the enmity and hatred of others make you avoid justice. ) The Ayah commands: Do not be carried away by your hatred for some people to avoid observing justice with them. Rather, be just with every one, whether a friend or an enemy. This is why Allah said,
اعْدِلُواْ هُوَ أَقْرَبُ لِلتَّقْوَى
(Be just: that is nearer to Taqwa) this is better than if you abandon justice in this case. Although Allah said that observing justice is `nearer to Taqwa’, there is not any other course of action to take, therefore `nearer’ here means `is’.