Sayyiduna Awf bin Malik al-Ashja'i (may Allah be pleased with him) said that the Messenger of Allah (peace and blessings be upon him) said: "The best of you and the best of your rulers are those whom you love and who love you, for whom you pray and who pray for you; and the worst of you and the worst of your rulers are those whom you hate and who hate you, whom you curse and who curse you." The Companions said: Then should we not rebel against them, O Messenger of Allah? He (peace and blessings be upon him) said: "No, as long as they establish the five prayers. However, whoever has a ruler over him and sees him committing some disobedience to Allah, let him hate that disobedience. Beware! Do not withdraw your hand from obedience."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 15206
It is narrated from Sayyiduna Awf bin Malik (may Allah be pleased with him) that the Prophet (peace and blessings be upon him) said: "The best of your rulers are those whom you love and who love you, for whom you supplicate to Allah and who supplicate for you; and the worst of your rulers are those whom you hate and who hate you, whom you curse and who curse you." It was said: O Messenger of Allah, then should we not rebel against them? He (peace and blessings be upon him) said: "No, as long as they establish the prayer among you. So if you see in your ruler something you dislike, then hate his deed, and do not withdraw your hand from obedience."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 15207
Sayyiduna Awf bin Malik (may Allah be pleased with him) said that the Messenger of Allah (peace and blessings be upon him) said: "The best of your rulers are those whom you love and who love you, for whom you pray and who pray for you; and the worst of your rulers are those whom you hate and who hate you, whom you curse and who curse you." We said: O Messenger of Allah, then should we not rebel against them at that time? He (peace and blessings be upon him) said: "No, as long as they establish the prayer among you. And whoever has a ruler over him and sees in him some disobedience to Allah, let him hate that disobedience, and let him not withdraw his hand from obedience."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 15208