In The Name of Allaah, The Most Merciful, The Bestower of Mercy
The great eighth century scholar Ibn al-Qayyim (died 752H) said:
“The Prophet (salallaahu ‘alaihi wassallam) legislated for this nation the obligation of rejecting the evil so that by its rejection, the goodness that Allāh and His Messenger love is obtained. And when rejecting evil leads to what is more evil and more hated by Allāh and His Messenger then it is not allowed to reject it – even if Allāh hates the evil and detests those who perform it. And this is like censuring [the transgressions] of the kings and the ones in authority by coming out to fight against them for verily that is the basis and foundation of every evil and every tribulation till the end of time. And the Companions asked permission from Allāh’s Messenger to kill the leaders who delay the prayer from its correct time saying, ‘Shall we not kill them?’ He replied, ‘No, so long as they establish the prayer.’ And he also said, ‘Whoever sees something from his Ruler that he dislikes, then let him be patient and let him not remove his hand from the Ruler’s obedience.’
And whoever reflects upon the greatest and smallest trials that have befallen Islām, then he will see that that they are due to the negligence and wastage of this principle and the lack of patience when witnessing evil. So one seeks to bring about an end to evil and as a result of this, instead a greater evil is brought about. And the Messenger saw the greatest of evils in Mecca and yet he was not able to change them. In fact even when Allāh opened up Mecca for the Muslims and it became a land of Islām, he was resolved to changing the Kaʿbah and returning it to the foundations that Ibrāhīm had built it upon, but even though he had the capacity to do that, he was prevented from it by the fear that something greater would occur due to the lack of tolerance of the [tribe of] Quraish, since they were new to Islām and had recently left unbelief.
For this reason he did not grant permission for rebelling against the leaders with the use of one’s hand due to the greatness of what results afterwards on account of it.” http://www.abukhadeejah.com/the-tyranny-of-the-rulers-a-reason-for-rebellion/