Sahih Muslim 1854 b
It has been narrated (through a different chain of tmnamitters) 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.)
وَحَدَّثَنِي أَبُو غَسَّانَ الْمِسْمَعِيُّ، وَمُحَمَّدُ بْنُ بَشَّارٍ، جَمِيعًا عَنْ مُعَاذٍ، - وَاللَّفْظُ لأَبِي غَسَّانَ - حَدَّثَنَا مُعَاذٌ، - وَهُوَ ابْنُ هِشَامٍ الدَّسْتَوَائِيُّ - حَدَّثَنِي أَبِي، عَنْ قَتَادَةَ، حَدَّثَنَا الْحَسَنُ، عَنْ ضَبَّةَ بْنِ مِحْصَنٍ الْعَنَزِيِّ، عَنْ أُمِّ سَلَمَةَ، زَوْجِ النَّبِيِّ صلى الله عليه وسلم عَنِ النَّبِيِّ صلى الله عليه وسلم أَنَّهُ قَالَ ‏"‏ إِنَّهُ يُسْتَعْمَلُ عَلَيْكُمْ أُمَرَاءُ فَتَعْرِفُونَ وَتُنْكِرُونَ فَمَنْ كَرِهَ فَقَدْ بَرِئَ وَمَنْ أَنْكَرَ فَقَدْ سَلِمَ وَلَكِنْ مَنْ رَضِيَ وَتَابَعَ ‏"‏ ‏.‏ قَالُوا يَا رَسُولَ اللَّهِ أَلاَ نُقَاتِلُهُمْ قَالَ ‏"‏ لاَ مَا صَلَّوْا ‏"‏ ‏.‏ أَىْ مَنْ كَرِهَ بِقَلْبِهِ وَأَنْكَرَ بِقَلْبِهِ ‏.‏