The ruler who does not rule according to the Book of Allaah and the Sunnah of His Messenger should be obeyed in matters that do not involve disobedience towards Allaah and His Messenger, and it is not obligatory to fight him because of that; rather it is not permissible to do so unless he reaches the level of kufr, in which case it becomes obligatory to oppose him and he has no right to be obeyed by the Muslims.
Ruling according to anything other than that which is in the Book of Allaah and the Sunnah of His Messenger reaches the level of kufr when two conditions are met:
1. When he knows the ruling of Allaah and His Messenger; if he is unaware of it, then he does not commit kufr by going against it.
2. When what makes him rule by something other than that which Allaah has revealed is the belief that it is a ruling that is not suitable for our time and that something else is more suitable than it and more beneficial for people.
If these two conditions are met, then ruling by something other than that which Allaah has revealed constitutes kufr which puts a person beyond the pale of Islam, because Allaah says (interpretation of the meaning): “And whosoever does not judge by what Allaah has revealed, such are the Kaafiroon (i.e. disbelievers)” [al-Maa’idah 5:44]. The authority of the ruler becomes invalid and he has no right to be obeyed by the people; it becomes obligatory to fight him and remove him from power.
But if he rules by something other than that which Allaah has revealed whilst believing that ruling by that – i.e. that which Allaah has revealed -- is what is obligatory, and that it is more suitable for the people, but he goes against it because of some whims and desires on his part or because he wants to wrong the people under his rule, then he is not a kaafir; rather he is a faasiq (evildoer) or a zaalim (wrongdoer). His authority remains, and obeying him in matters that do not involve disobedience to Allaah and His Messenger is obligatory, and it is not permissible to fight him or remove him from power by force or to rebel against him, because the Prophet (blessings and peace of Allaah be upon him) forbade rebelling against rulers unless we see blatant kufr for which we have proof from Allaah. End quote.