In The Name of Allaah, The Most Merciful, The Bestower of Mercy.
Allaah [The Exalted] said:
يَـٰٓأَيُّہَا ٱلَّذِينَ ءَامَنُواْ كُونُواْ قَوَّٲمِينَ بِٱلۡقِسۡطِ شُہَدَآءَ لِلَّهِ وَلَوۡ عَلَىٰٓ أَنفُسِكُمۡ أَوِ ٱلۡوَٲلِدَيۡنِ وَٱلۡأَقۡرَبِينَۚ إِن يَكُنۡ غَنِيًّا أَوۡ فَقِيرً۬ا فَٱللَّهُ أَوۡلَىٰ بِہِمَاۖ فَلَا تَتَّبِعُواْ ٱلۡهَوَىٰٓ أَن تَعۡدِلُواْۚ وَإِن تَلۡوُ ۥۤاْ أَوۡ تُعۡرِضُواْ فَإِنَّ ٱللَّهَ كَانَ بِمَا تَعۡمَلُونَ خَبِيرً۬ا
O you who believe! Stand out firmly for justice, as witnesses to Allah; even though it be against yourselves, or your parents, or your kin, be he rich or poor, Allah is a Better Protector to both (than you). So follow not the lusts (of your hearts), lest you may avoid justice, and if you distort your witness or refuse to give it, verily, Allah is Ever Well-Acquainted with what you do. [Surah An-Nisaa. Ayah 135]
Imaam Ibnul Qayyim [may Allaah have mercy upon him] said: Allaah [Glorified be He and free is He from all Imperfections] commanded His servants to stand out firmly for justice on behalf of everyone – be it an enemy or an ally. And the affair that is most worthy of being established with justice -by a person- are the (sound and upright) statements, views and methodology related to the commands of Allaah as well as everything that Allaah has informed (His slaves in the Qur’aan and the authentic Sunnah). Therefore, to establish these affairs based on desires and disobedience is contrary to the command of Allaah and a negation (i.e. either intentionally or unintentionally) of that which Allaah’s Messenger [peace and blessings of Allaah be upon him] was sent with [i.e. the Qur’aan and the authentic Sunnah]. The establishment of justice (i.e. based on the Qur’aan and authentic Sunnah) is the responsibility of those entrusted with the task to convey Islam after the death of the Messenger [peace and blessings of Allaah be upon him], and this task cannot become a reality unless when one establishes it based on pure justice and sincerity to Allaah- (sincerity) to Allaah’s Book, to Allaah’s Messenger and out of sincere advice to Allaah’s servants. These people are the true inheritors [i.e. inheritors of the knowledge left behind by the Prophets], but not that one who merely makes his companions, sect and school of thought the determinant of truth and the distinction between (truth and falsehood) by showing enmity towards the one who opposes him and allies with the one who agrees with him, merely based on being opposed or agreed with (i.e. without sound proofs based on the Book and the authentic Sunnah), because where is that (application of the) command to stand out firmly for justice on behalf of everyone, even though standing out firmly for justice is the greatest command and obligation?!
Then Allaah (The Most High) says: [شُہَدَآءَ لِلَّهِ – As witnesses to Allah]: A witness is that one who presents information about something, so if he presents credible information, he is a just witness and his (statement) is accepted; but if he gives false information, he is a false witness. Allaah [The Most High] commanded us to stand out firmly as just witnesses for His sake, therefore it has to be carried out for the Sake of Allaah and not for other than Allaah. And in [Surah Al-Maa’idah Ayah 8, Allaah (The Most High) said]: [كُونُواْ قَوَّٲمِينَ لِلَّهِ شُہَدَآءَ بِٱلۡقِسۡطِۖ – Stand out firmly for Allah and be just witnesses]: This Aayah establishes four affairs: One should stand out firmly for justice and do so for sake of Allaah; witness to justice and do so for the Sake of Allaah.
Then Allaah [The Most High] said: [وَلَوۡ عَلَىٰٓ أَنفُسِكُمۡ أَوِ ٱلۡوَٲلِدَيۡنِ وَٱلۡأَقۡرَبِينَۚ – Even though it be against yourselves, or your parents, or your kin].
Allaah [Glorified be He and free is He from all imperfections] commanded us to stand out firmly for justice and testify (for or against) everyone, even if it were someone who is the most beloved person to us. A person should stand out firmly for justice (whether for or against) himself, his two parents, his other close relatives and his best friend amongst the people. If a person’s love for himself, his parents and his relatives prevents him from standing out firmly for the truth against them, especially if the truth is with someone he hates and regards as an enemy due to them, then indeed none will stand out firmly for justice in such circumstances except one whose love for Allaah and His Messenger is more than their love for everyone else.
A person has to establish justice when dealing with his enemies and (when dealing with) that one who deprives him of his rights, because indeed it is not permissible that hatred for his enemies leads him to be unjust towards them, just as it is not permissible (to allow) love of himself, his parents and relatives to make him abandon standing firmly for justice against them. Therefore, hatred harboured against someone should not lead him to falsehood, and love (of himself, parents and relatives) should not make him fall short in establishing truth, just as one of the pious predecessors said, “The just person is that one who when angry his anger does not lead him to falsehood, and when he is pleased it does not remove him from truth”. The two verses of the Qur’aan [i.e. 4:135 and 5:8] convey two rulings and they are: Standing out firmly for justice and making a truthful testimony on behalf of one’s allies and enemies.
Then Allaah [The Most High] said: [إِن يَكُنۡ غَنِيًّا أَوۡ فَقِيرً۬ا فَٱللَّهُ أَوۡلَىٰ بِہِمَاۖ – Be he rich or poor, Allah is a Better Protector to both (than you)]- Meaning: Allaah is the Lord of both of them and their Protector, and they are both His slaves. It may be that you become fearful of standing firmly for justice by testifying against a rich person or a poor person – either fearing that the rich person might lose his wealth or because the poor person has nothing, so your hearts become lackadaisical towards standing out firmly for the truth. Therefore, it should be said to them [i.e. the people], “Allah is a Better Protector to both the rich and poor person. Allaah knows the affair of the rich person more than you and He is more Merciful to the poor than you, so do not refrain from standing out firmly for the truth and from giving testimony (for or against) the rich or the poor”.
Then Allaah said: [فَلَا تَتَّبِعُواْ ٱلۡهَوَىٰٓ أَن تَعۡدِلُواْۚ – So follow not the lusts (of your hearts), lest you may avoid justice]-Meaning: Allaah forbids (His slaves) from following desires, which will lead them to abandon justice.
Then Allaah [The Most High] said: [وَإِن تَلۡوُ ۥۤاْ أَوۡ تُعۡرِضُواْ فَإِنَّ ٱللَّهَ كَانَ بِمَا تَعۡمَلُونَ خَبِيرً۬ا – and if you distort your witness or refuse to give it, verily, Allah is Ever Well-Acquainted with what you do]- Meaning: Allaah [Glorified be He and free is He from all imperfections] mentions two reasons that will inevitably lead to concealment of truth, then He warned against them and issued a threat: The first of them is distortion and the second is to turn away from giving truthful witness. That is because when a proof that supports the truth is manifested and the one who wants to repel it finds no way of doing so, he refrains from mentioning it and thus becomes a silent devil, and sometimes he distorts it. Distortion is of two types: distorting words and distorting meanings. Distorting words is when one utters a word in a context in which it does not establish the truth – either adding to the word or omitting something from it or substituting it with something else to the extent that the listener is made to believe something, whilst something else is intended by it, just as the Yahood [i.e. those Yahood who disbelieved in the Prophet and hated him] used to distort words when giving Salaam to the Prophet [i.e. saying As-Saamu Alayka (death be upon you), instead of saying Assalaamu alaykum)]. This is one type of distortion.
The second type of distortion is related to meanings – distorting the wording, giving it an interpretation that is not intended by the one who uttered it and pretending not to know its unintended meaning; or dropping other meanings intended by it etc. Allaah [The Most High] said: [وَإِن تَلۡوُ ۥۤاْ أَوۡ تُعۡرِضُواْ فَإِنَّ ٱللَّهَ كَانَ بِمَا تَعۡمَلُونَ خَبِيرً۬ا – and if you distort your witness or refuse to give it, verily, Allah is Ever Well-Acquainted with what you do].
And when it is the case that a witness is required to bear witness based on what the affair should be [i.e. the complete truth], therefore neither should he hide nor change it. Turning away from the testimony is tantamount to concealment and distortion is tantamount to alteration and substitution. Therefore, contemplate on this ayah and the treasures of knowledge it contains. The faith of a person cannot be complete, except by way of accepting the texts of the divine legislation and calling the people to them – neither turning away from them at times nor distorting them at other times. [An Excerpt from ‘Badaa’i At-Tafseer Al-Jaami Limaa Fassarahu Al-Imaam Ibnul Qayyim. Vol 1. Page 300-303. Slightly paraphrased]