In the name of Allah, the Beneficent, the Merciful

In Islam, we should always stand for justice as a matter of principle, whether for Muslims or non-Muslims, even if justice should side against us.

Allah said:

يَا أَيُّهَا الَّذِينَ آمَنُوا كُونُوا قَوَّامِينَ بِالْقِسْطِ شُهَدَاءَ لِلَّهِ وَلَوْ عَلَىٰ أَنفُسِكُمْ أَوِ الْوَالِدَيْنِ وَالْأَقْرَبِينَ إِن يَكُنْ غَنِيًّا أَوْ فَقِيرًا فَاللَّهُ أَوْلَىٰ بِهِمَا فَلَا تَتَّبِعُوا الْهَوَىٰ أَن تَعْدِلُوا وَإِن تَلْوُوا أَوْ تُعْرِضُوا فَإِنَّ اللَّهَ كَانَ بِمَا تَعْمَلُونَ خَبِيرًا

O you who believe, be persistently standing firm in justice as witnesses for Allah, even if it be against yourselves or parents and relatives. Whether one is rich or poor, Allah is more worthy of both. Follow not your desires, lest you not be just. If you distort your testimony or refuse to give it, then Allah is aware of what you do.

Surat An-Nisa 4:135

And Allah said:

إِنَّ اللَّهَ يَأْمُرُ بِالْعَدْلِ وَالْإِحْسَانِ وَإِيتَاءِ ذِي الْقُرْبَىٰ وَيَنْهَىٰ عَنِ الْفَحْشَاءِ وَالْمُنكَرِ وَالْبَغْيِ يَعِظُكُمْ لَعَلَّكُمْ تَذَكَّرُونَ

Verily, Allah orders justice and good conduct and giving to relatives and He forbids immorality and bad conduct and oppression. He admonishes you that perhaps you will be reminded.

Surat An-Nahl 16:90

And Allah said:

إِنَّ اللَّهَ يَأْمُرُكُمْ أَن تُؤَدُّوا الْأَمَانَاتِ إِلَىٰ أَهْلِهَا وَإِذَا حَكَمْتُم بَيْنَ النَّاسِ أَن تَحْكُمُوا بِالْعَدْلِ إِنَّ اللَّهَ نِعِمَّا يَعِظُكُم بِهِ إِنَّ اللَّهَ كَانَ سَمِيعًا بَصِيرًا

Verily, Allah commands you to render trusts to whom they are due and when you judge between people to judge with justice. Excellent is that which Allah instructs you. Verily, Allah is ever hearing and seeing.

Surat An-Nisa 4:58

Justice is one of the core tenets of Islamic teachings. Whatever is just is necessarily a part of the religion of Islam.

Ibn Al-Qayyim said:

قَدْ بَيَّنَ سُبْحَانَهُ بِمَا شَرَعَهُ مِنْ الطُّرُقِ أَنَّ مَقْصُودَهُ إقَامَةُ الْعَدْلِ بَيْنَ عِبَادِهِ وَقِيَامُ النَّاسِ بِالْقِسْطِ فَأَيُّ طَرِيقٍ اُسْتُخْرِجَ بِهَا الْعَدْلُ وَالْقِسْطُ فَهِيَ مِنْ الدِّينِ وَلَيْسَتْ مُخَالِفَةً لَهُ

Allah the Exalted has made clear in his law (sharia) that the objective is the establishment of justice between His servants and fairness among the people, so whichever path leads to justice and fairness is part of the religion and can never oppose it.

Source: al-Ṭuruq al-Ḥikmīya 13

We should never let our hatred for people or their sins be a cause for us to oppress them. Hatred, when misdirected at people instead of evil in the abstract, is a dangerous spiritual disease that often leads to acts of injustice.

Allah said:

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

O you who believe, be persistently standing firm for Allah as witnesses in justice, and do not let the hatred of a people prevent you from being just. Be just, for that is nearer to righteousness. Fear Allah, for verily, Allah is aware of what you do.

Surat Al-Ma’idah 5:8

These commands apply equally to unbelievers as they apply to believers. Muslims should be just and fair to all non-Muslims in every circumstance.

Al-Qurtubi said:

وَدَلَّتِ الْآيَةُ أَيْضًا عَلَى أَنَّ كُفْرَ الْكَافِرِ لَا يَمْنَعُ مِنَ الْعَدْلِ عَلَيْهِ

This verse shows that the unbelief of the unbeliever does not prevent him from enjoying justice.

Source: Tafseer Al-Qurtubi 5:8

In Islam, even the highest official, the Caliph, is subject to the same rules of justice as everyone else. There is a famous incident in which Ali Ibn Abu Talib, RadiyAllahu Anhu, lost a court case to a Christian because he lacked evidence, even though Ali, RadiyAllahu Anhu, was the Caliph at the time.

Sha’bi reported: Ali ibn Abu Talib, RadiyAllahu Anhu, found a Christian man with his armor. He decided to take up the matter legally, so he brought the dispute to the judge, Shuraih. Ali, RadiyAllahu Anhu, said

“This is my armor and I have not sold it nor given it away.”

Shuraih said to the Christian:

“What do you say about what the leader of the believers has said?”

The Christian replied:

“It is my armor, but I do not consider the leader of the believers to be a liar.”

Shuraih turned to Ali, RadiyAllahu Anhu, and said:

“O leader of the believers, do you have proof?”

Ali, RadiyAllahu Anhu, laughed and said:

“Shuraih is correct. I do not have proof.”

So Shuraih ruled in favor of the Christian.

The Christian took the armor and began to walk away but then he returned.

The Christian said:

أَمَّا أَنَا فَأَشْهَدُ أَنَّ هَذِهِ أَحْكَامُ الْأَنْبِيَاءِ أَمِيرُ الْمُؤْمِنِينَ قَدَّمَنِي إِلَى قَاضِيهِ وَقَاضِيهِ يَقْضِي عَلَيْهِ ! أَشْهَدُ أَنْ لَا إِلَهَ إِلَّا اللَّهُ وَأَشْهَدُ أَنَّ مُحَمَّدًا عَبْدُهُ وَرَسُولُهُ الدِّرْعُ وَاللَّهِ دِرْعُكَ يَا أَمِيرَ الْمُؤْمِنِينَ اتَّبَعْتُ الْجَيْشَ وَأَنْتَ مُنْطَلِقٌ إِلَى صِفِّينَ فَخَرَجَتْ مِنْ بَعِيرِكَ الْأَوْرَقِ

As for me, I testify that this is the judgment of the Prophets. The leader of the believers himself takes me to his judge and the judge rules against him! I testify that there is no God except Allah, and I testify that Muhammad is the Messenger of Allah. By Allah, the armor is yours, O leader of the believers. I followed the army when you were on your way to the Battle of Siffin and the armor fell from your equipment.

Ali, RadiyAllahu Anhu, said:

أَمَا إِذْ أَسْلَمْتَ فَهِيَ لَكَ

If you have accepted Islam, then the armor is for you.

Source: Al-Bidayah wa-Nihayah 11/107

The reward for being just and fair is tremendous. The people who practice justice in all their matters will be given a special, exalted status on the Day of Judgment.