In the name of Allāh, Most Merciful, Bestower of Mercy.
Muslim reports from Hudhayfah (radiyallahu ʿanhu) in a marfuʿ narration, that the Prophet (sallallāhu ʿalayhi wa-sallam) said:
سَتَكُونُ بَعْدِي أَئِمَّةٌ لَا يَهْتَدُونَ بِهُدَايَ، وَلَا يَسْتَنُّونَ بِسُنَّتِي، وَسَيَقُومُ فِيهِمْ رِجَالٌ قُلُوبُهُمْ قُلُوبُ الشَّيَاطِينِ فِي جُثْمَانِ إِنْسٍ.
“There will come after me rulers who will not be guided by my guidance, nor follow my Sunnah. Among them there will be men whose hearts are the hearts of devils in the bodies of humans.”
Hudhayfah said: “I asked, ‘O Messenger of Allah, what should I do if I encounter that?’ He replied:
تَسْمَعُ وَتُطِيعُ الْأَمِيرَ، وَإِنْ ضُرِبَ ظَهْرُكَ، وَأُخِذَ مَالُكَ، فَاسْمَعْ وَأَطِعْ.
“You are to hear and obey the ruler, even if he strikes your back and takes your wealth. Hear and obey.” Reported by Muslim no. (1847) (52).
Al-ʿAllāmah Sālih al-Fawzān (may Allāh preserve him) said:
As for his statement (sallallāhu ʿalayhi wa-sallam) in the hadīth of Hudhayfah, “There will come after me rulers who will not be guided by my guidance, nor follow my Sunnah,” this is an instruction to show patience in obeying those in authority, even if they are not upright, provided they have not reached the level of disbelief. This is because it preserves the unity of the Muslims. It is also an adopting the lesser of two harms in order to repel the greater of them.
His statement, “Even if he strikes your back and takes your wealth,” is evidence for the obligation of hearing and obeying the ruler, even if he wrongs you. This is obligatory, and in such circumstances one must show patience and not break away from obedience, due to the corruption that would result from doing so.
This applies to sinful rulers—then what about dealing with rulers who are obedient to Allah, righteous and upright? So what, then, of rulers who are righteous and just, who do not transgress the limits set by Allah?
It must also be pointed out that when the servants disobey Allah, Allah allows oppressive rulers to gain authority over them. Allah, the Most High, says:
وَكَذَٰلِكَ نُوَلِّي بَعْضَ الظَّالِمِينَ بَعْضًا بِمَا كَانُوا يَكْسِبُونَ
“And thus We make some of the wrongdoers allies of others because of what they used to earn.” [al-Anʿam 6:129]
Source: Sharh Kitāb al-Kabā’ir (p. 551).
Abu Khadeejah.