Sahih Muslim Book 20, Hadith Number 4570.

Chapter : Justification for hating the Amirs for violating the laws of the Shari’ah.

It has been narrated (through a different chain of transmitters) on the authority of Umm Salama (wife of the Holy Prophet) that he said: Amirs will be appointed over you, and you will find them doing good as well as bad deeds. One who hates their bad deeds is absolved from blame. One who disapproves of their bad deeds is (also) safe (so far as Divine wrath is concerned). But one who approves of their bad deeds and imitates them (is doomed). People asked: Messenger of Allah, shouldn’t we fight against them? He replied: No, as long as they say their prayer. (“Hating and disapproving” refers to liking and disliking from the heart.)