The great Imaam al-Barbahaaree  (died 329H, may Allaah’s mercy be upon him) stated the position and consensus of the Muslims towards their rulers:

“If you find a man making supplication against the ruler, know that he is a person of innovation (deviation). If you find a person making supplication for the ruler to be upright, know that he is a person of the Sunnah, if Allaah wills.

We are ordered to make supplication for them (i.e. the rulers) to be upright. We have not been ordered to make supplication against them, even if they commit tyranny and oppression, since their tyranny and oppression reflect only upon themselves but their rectitude is good for themselves and the Muslims.” [1]


[1] Sharhus-Sunnah of al-Barbahaaree