Riyad as-Salihin, Book 1, Hadith 661 (In-Book)

'Auf bin Malik (May Allah be pleased with him) reported: Messenger of Allah said, "The best of your rulers are those whom you love and who love you, and those who supplicate Allah in your favour and you supplicate Allah in their favour. 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 who were present): "Should not we oppose them?" He said, "No, as long as they establish Salat; as long as they establish Salat in your midst."[Muslim].

وعن عوف بن مالك رضي الله عنه قال‏:‏ سمعت رسول الله صلى الله عليه وسلم يقول‏:‏ “خياركم أئمتكم الذين تحبونهم ويحبونكم، وتصلون عليهم ويصلون عليكم، وشرار أئمتكم الذين تبغضونهم ويبغضونكم، وتلعنونهم ويلعنونهم‏!‏” قال‏:‏ قلنا يا رسول الله، أفلا ننابذه‏؟‏ قال‏:‏ لا، ما أقاموا فيكم الصلاة، لا ما أقاموا فيكم الصلاة” ‏(‏‏(‏رواه مسلم‏)‏‏)‏‏.‏

sunnah.com