The Messenger of Allah ﷺ said, "The best of your leaders are those whom you love and who love you, who pray for you and for whom you pray. The worst of your leaders are those whom you hate and who hate you, whom you curse and who curse you."Someone asked, "Messenger of Allah, should we not take up the sword against them?"He replied, "No, not as long as they establish the prayer among you. If you see something objectionable from your rulers, then dislike their action, but do not withdraw your hand from obedience."
عن رسول الله ﷺ قال: خيار أئمتكم الذين تحبونهم ويحبونكم ويصلون عليكم وتصلون عليهم، وشرار أئمتكم الذين تبغضونهم ويبغضونكم وتلعنونهم ويلعنونكم، قيل: يا رسول الله أفلا ننابذهم بالسيف؟ فقال: لا، ما أقاموا فيكم الصلاة وإذا رأيتم من ولاتكم شيئا تكرهونه فاكرهوا عمله، ولا تنزعوا يدا من طاعة.
Muslim narrated it in the Book of Governance (1855: 65), from Ishaq bin Ibrahim Hanzali, who said, Isa bin Yunus reported to us, Uzai narrated to us, from Yazid bin Yazid bin Jabir, from Ruzayq bin Hayan, from Muslim bin Qarazah, from Awf bin Malik, who mentioned it.