صحيح مسلم Sahih Muslim كتاب الإمارة The Book on Government
باب وُجُوبِ الإِنْكَارِ عَلَى الأُمَرَاءِ فِيمَا يُخَالِفُ الشَّرْعَ وَتَرْكِ قِتَالِهِمْ مَا صَلَّوْا وَنَحْوِ ذَلِكَ:

Chapter: The obligation to denounce rulers for that in which they go against Shari'ah, but they should not be fought so long as they pray regularly, etc

4 hadith
Hadith 1854
حَدَّثَنَا هَدَّابُ بْنُ خَالِدٍ الْأَزْدِيُّ ، حَدَّثَنَا هَمَّامُ بْنُ يَحْيَي ، حَدَّثَنَا قَتَادَةُ ، عَنْ الْحَسَنِ ، عَنْ ضَبَّةَ بْنِ مِحْصَنٍ ، عَنْ أُمِّ سَلَمَةَ ، أَنّ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ ، قَالَ : " سَتَكُونُ أُمَرَاءُ فَتَعْرِفُونَ وَتُنْكِرُونَ ، فَمَنْ عَرَفَ بَرِئَ وَمَنْ أَنْكَرَ سَلِمَ وَلَكِنْ مَنْ رَضِيَ " ، وَتَابَعَ ، قَالُوا : أَفَلَا نُقَاتِلُهُمْ ، قَالَ : لَا مَا صَلَّوْا " .
It has been narrated on the authority of Umm Salamah that the Messenger of Allah (ﷺ) said: In the near future there will be Amirs and you will like their good deeds and dislike their bad deeds. One who sees through their bad deeds (and tries to prevent their repetition by his band or through his speech), is absolved from blame, but one who hates their bad deeds (in the heart of his heart, being unable to prevent their recurrence by his hand or his tongue), is (also) fafe ( so far as God's wrath is concerned). But one who approves of their bad deeds and imitates them is spiritually ruined. People asked (the Holy Prophet): Shouldn't we fight against them? He replied: No, as long as they say their prayers.
Hadith Reference Sahih Muslim / The Book on Government / Hadith: 1854
Hadith Grading محدثین: أحاديث صحيح مسلم كلها صحيحة
Hadith Takhrij «أحاديث صحيح مسلم كلها صحيحة»
Hadith 1854
وحَدَّثَنِي أَبُو غَسَّانَ الْمِسْمَعِيُّ ، وَمُحَمَّدُ بْنُ بَشَّارٍ جميعا ، عَنْ مُعَاذٍ وَاللَّفْظُ لِأَبِي غَسَّانَ ، حَدَّثَنَا مُعَاذٌ وَهُوَ ابْنُ هِشَامٍ الدَّسْتَوَائِيُّ ، حَدَّثَنِي أَبِي ، عَنْ قَتَادَةَ ، حَدَّثَنَا الْحَسَنُ ، عَنْ ضَبَّةَ بْنِ مِحْصَنٍ الْعَنَزِيِّ ، عَنْ أُمِّ سَلَمَةَ زَوْجِ النَّبِيِّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ ، عَنِ النَّبِيِّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ ، أَنَّهُ قَالَ : " إِنَّهُ يُسْتَعْمَلُ عَلَيْكُمْ أُمَرَاءُ فَتَعْرِفُونَ وَتُنْكِرُونَ ، فَمَنْ كَرِهَ فَقَدْ بَرِئَ ، وَمَنْ أَنْكَرَ فَقَدْ سَلِمَ ، وَلَكِنْ مَنْ رَضِيَ وَتَابَعَ ، قَالُوا : يَا رَسُولَ اللَّهِ ، أَلَا نُقَاتِلُهُمْ ، قَالَ : لَا مَا صَلَّوْا ، أَيْ مَنْ كَرِهَ بِقَلْبِهِ وَأَنْكَرَ بِقَلْبِهِ " ،
It has been narrated (through a different chain of tmnamitters) on the authority of Umm Salamah (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.)
Hadith Reference Sahih Muslim / The Book on Government / Hadith: 1854
Hadith Grading محدثین: أحاديث صحيح مسلم كلها صحيحة
Hadith Takhrij «أحاديث صحيح مسلم كلها صحيحة»
Hadith 1854
وحَدَّثَنِي أَبُو الرَّبِيعِ الْعَتَكِيُّ ، حَدَّثَنَا حَمَّادٌ يَعْنِي ابْنَ زَيْدٍ ، حَدَّثَنَا الْمُعَلَّى بْنُ زِيَادٍ ، وَهِشَامٌ ، عَنْ الْحَسَنِ ، عَنْ ضَبَّةَ بْنِ مِحْصَنٍ ، عَنْ أُمِّ سَلَمَةَ ، قَالَتْ : قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ بِنَحْوِ ذَلِكَ غَيْرَ أَنَّهُ ، قَالَ : " فَمَنْ أَنْكَرَ فَقَدْ بَرِئَ وَمَنْ كَرِهَ فَقَدْ سَلِمَ " ،
Another version of the tradition narrated on the same authority attributes the same words to the Messenger of Allah (ﷺ) except that it replaces kariha with ankhara and vice versa.
Hadith Reference Sahih Muslim / The Book on Government / Hadith: 1854
Hadith Grading محدثین: أحاديث صحيح مسلم كلها صحيحة
Hadith Takhrij «أحاديث صحيح مسلم كلها صحيحة»
Hadith 1854
وحَدَّثَنَاه حَسَنُ بْنُ الرَّبِيعِ الْبَجَلِيُّ ، حَدَّثَنَا ابْنُ الْمُبَارَكِ ، عَنْ هِشَامٍ ، عَنْ الْحَسَنِ ، عَنْ ضَبَّةَ بْنِ مِحْصَنٍ ، عَنْ أُمِّ سَلَمَةَ ، قَالَتْ : قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ ، فَذَكَرَ مِثْلَهُ إِلَّا قَوْلَهُ وَلَكِنْ مَنْ رَضِيَ وَتَابَعَ لَمْ يَذْكُرْهُ .
Another version omits a portion at the end of the tradition-a portion which begins with man radiya wa taba and ends with the last word of the tradition.
Hadith Reference Sahih Muslim / The Book on Government / Hadith: 1854
Hadith Grading محدثین: أحاديث صحيح مسلم كلها صحيحة
Hadith Takhrij «أحاديث صحيح مسلم كلها صحيحة»