Sahih Muslim 1855 a
It has been narrated on the authority of 'Auf b. Malik that the Messenger of Allah (ﷺ) said:
The best of your rulers are those whom you love and who love you, who invoke God's blessings upon you and you invoke His blessings upon them. And the worst of your rulers are those whom you hate and who hate you and whom you curse and who curse you. It was asked (by those present): Shouldn't we overthrow them with the help of the sword? He said: No, as long as they establish prayer among you. If you then find anything detestable in them. You should hate their administration, but do not withdraw yourselves from their obedience.
حَدَّثَنَا إِسْحَاقُ بْنُ إِبْرَاهِيمَ الْحَنْظَلِيُّ، أَخْبَرَنَا عِيسَى بْنُ يُونُسَ، حَدَّثَنَا الأَوْزَاعِيُّ، عَنْ يَزِيدَ بْنِ يَزِيدَ بْنِ جَابِرٍ، عَنْ رُزَيْقِ بْنِ حَيَّانَ، عَنْ مُسْلِمِ بْنِ قَرَظَةَ، عَنْ عَوْفِ بْنِ مَالِكٍ، عَنْ رَسُولِ اللَّهِ صلى الله عليه وسلم قَالَ ‏"‏ خِيَارُ أَئِمَّتِكُمُ الَّذِينَ تُحِبُّونَهُمْ وَيُحِبُّونَكُمْ وَيُصَلُّونَ عَلَيْكُمْ وَتُصَلُّونَ عَلَيْهِمْ وَشِرَارُ أَئِمَّتِكُمُ الَّذِينَ تُبْغِضُونَهُمْ وَيُبْغِضُونَكُمْ وَتَلْعَنُونَهُمْ وَيَلْعَنُونَكُمْ ‏"‏ ‏.‏ قِيلَ يَا رَسُولَ اللَّهِ أَفَلاَ نُنَابِذُهُمْ بِالسَّيْفِ فَقَالَ ‏"‏ لاَ مَا أَقَامُوا فِيكُمُ الصَّلاَةَ وَإِذَا رَأَيْتُمْ مِنْ وُلاَتِكُمْ شَيْئًا تَكْرَهُونَهُ فَاكْرَهُوا عَمَلَهُ وَلاَ تَنْزِعُوا يَدًا مِنْ طَاعَةٍ ‏"‏ ‏.‏