All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
Allaah Says (what means): {O you who have believed, obey Allaah and obey the Messenger and those in authority among you.} [Quran 4:59]
The meaning of {those in authority among you} are the scholars and the rulers as we clarified in Fatwa 2556. Therefore, it is an obligation to obey the Muslim ruler within what is permissible and whoever the ruler appoints as a deputy, it is an obligation to obey him as well.
Abu Hurayrah narrated that the Prophet said: "Whoever obeys me, he has indeed obeyed Allaah, and whoever disobeys me, he has indeed disobeyed Allaah, and whoever obeys my Emir (deputy), he has indeed obeyed me, and whoever disobey my Emir, he has indeed disobeyed me." [Al-Bukhari and Muslim]
The Muslim ruler should be obeyed in what is permissible even if he is an unjust person in himself; it is reported that the Prophet said to Huthayfah : "You should listen and obey the Emir, even if he hit you on the back and took your possessions, you should listen and obey him." [Muslim]
Allaah Knows best.