(16) باب وُجُوبِ الإِنْكَارِ عَلَى الأُمَرَاءِ فِيمَا يُخَالِفُ الشَّرْعَ وَتَرْكِ قِتَالِهِمْ مَا صَلَّوْا وَنَحْوِ ذَلِكَ
(16) 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
99
وَحَدَّثَنِي أَبُو الرَّبِيعِ الْعَتَكِيُّ، حَدَّثَنَا حَمَّادٌ، - يَعْنِي ابْنَ زَيْدٍ - حَدَّثَنَا الْمُعَلَّى بْنُ، زِيَادٍ وَهِشَامٌ عَنِ الْحَسَنِ، عَنْ ضَبَّةَ بْنِ مِحْصَنٍ، عَنْ أُمِّ سَلَمَةَ، قَالَتْ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم . بِنَحْوِ ذَلِكَ غَيْرَ أَنَّهُ قَالَ " فَمَنْ أَنْكَرَ فَقَدْ بَرِئَ وَمَنْ كَرِهَ فَقَدْ سَلِمَ " .
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.
Reference:
Sahih Muslim 1854 c
In-book reference:
Book 33, Hadith 99
USC-MSA web (English) reference(deprecated numbering scheme):
Book 20, Hadith 4571