Question: If a man has, for example, a neighbor who harms him, may he raise his case to the governor of his district, knowing that the district governor is neither just nor trustworthy?
The answer: What appears to me—and Allah knows best—is that it is permissible to raise the matter to the ruler in what is mentioned in the question, in order to rid him of the oppression of his neighbor. Thus said the people of the school, except that they made an exception, saying: unless he knows that the ruler will do to him more than he deserves, in which case it is not permissible.
And what may indicate what they said is the saying of Allah the Exalted: “And cooperate in righteousness and piety, and do not cooperate in sin and transgression” [Al-Māʾidah:2].
I say: This is if he has intention and purpose to wrong his neighbor. But if he has no intention or purpose except to rid himself of his neighbor’s harm, then it is permissible to raise the matter, even if it is the habit of that ruler to exceed the bounds of propriety.
The evidence for that is what has been narrated about Zayd ibn ʿAlī and ʿAbd Allāh ibn al-Ḥasan, peace be upon them, that they brought their dispute before the governors of Banū Umayyah, despite their knowledge that the governors of Banū Umayyah exceeded the limits in their judgments.
Source: Min Thimār al-ʿIlm wa al-Ḥikmah vol.3