It is narrated from Sayyiduna Anas bin Malik (may Allah be pleased with him) that Sayyiduna Mu'adh (may Allah be pleased with him) said: "O Messenger of Allah! What do you say if rulers are appointed over us who neither follow your Sunnah nor follow your command; what do you command regarding them?" The Messenger of Allah (peace and blessings be upon him) said: "There is no obedience to the one who does not obey Allah, the Mighty and Majestic."
It is narrated from Amr bin Zaynab al-Ghubari (may Allah have mercy on him) that Sayyiduna Anas bin Malik (may Allah be pleased with him) narrated to him that Sayyiduna Mu'adh (may Allah be pleased with him) said: "O Messenger of Allah (peace and blessings be upon him)! What do you think if there are rulers (imposed) over us", then he mentioned the like of it, except that Yahya bin Abi Kathir (may Allah have mercy on him) did not say the words "haddathana" (he narrated to us).
And Allah knows best.