Awf bin Malik reported,

I heard the Messenger of Allah ﷺ say, "The best of your leaders are those whom you love and who love you, those upon whom you invoke blessings and who invoke blessings upon you. The worst of your leaders are those whom you hate and who hate you, those whom you curse and who curse you."They said, "We asked, 'Messenger of Allah, should we not then confront them with the sword?'"He replied, "No, not as long as they establish the prayer among you. No, not as long as they establish the prayer among you. Whoever has a ruler placed over him and sees him committing some act of disobedience to Allah should hate the disobedience to Allah that he commits, but he must not withdraw his hand from obedience."

Azami 7640

Sahih

عن عوف بن مالك الأشجعي يقول

سمعت رسول الله ﷺ يقول: خيار أئمتكم الذين تحبونهم ويحبونكم، وتصلون عليهم ويصلون عليكم، وشرار أئمتكم الذين تبغضونهم ويبغضونكم، وتلعنونهم ويلعنونكم قالوا: قلنا: يا رسول الله أفلا ننابذهم عند ذلك؟ قال: لا ما أقاموا فيكم الصلاة، لا ما أقاموا فيكم الصلاة، ألا من ولي عليه، وال، فرآه يأتي شيئا من معصية الله فليكره ما يأتي من معصية الله، ولا ينزعن يدا من طاعة.

الأعظمي 7640صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Leadership
Section
Injustice of the ruler and his selfishness do not prevent hearing and obeying
Numbering
Jami al-Kamil 7640 (2nd edition)