‘Auf b. Malik al-Ashja‘i reported God's Messenger as saying, “Your best imams are those whom you like and who like you, on whom you invoke blessings and who invoke blessings on you; and your worst imams are those whom you hate and who hate you, whom you curse and who curse you.” They asked God's Messenger whether in that event they should not depose them, but he replied, “No, as long as they observe the prayer among you; no, as long as they observe the prayer among you. If anyone has a governor whom he sees doing anything which is an act of disobedience to God, he must disapprove of the disobedience to God which he commits, but must never withdraw from obedience.”
Abu Huraira told that he heard God’s Messenger say, “He who abandons obedience and separates from the community and then dies, will die like those of pre-Islamic times; he who fights under a banner of ignorance* showing anger in support of party spirit, or summoning people to party spirit, or helping party spirit, and then is killed will be killed like those of pre-Islamic times; and he who goes out against my people with his sword smiting the virtuous and the reprobate, not keeping away from those who are believers or observing covenants which have been made, has nothing to do with me and I have nothing to do with him.”
Muslim transmitted it.
*'Immiya, or 'ummiya, meaning either pride or error. I have translated it as ‘‘ignorance, for it is explained as being here used of people who fight without considering whether they are in the right or not.
Umm Salama reported God’s Messenger as saying, “You will have commanders some of whom you will approve and some of whom you will disapprove. He who expresses disapproval is guiltless and he who feels disapproval is safe, but he who is pleased and follows them ...” His hearers interrupted, “Shall we not fight with them?” but he replied, “No, as long as they pray; no, as long as they pray.” It means one who feels disapproval in his heart and expresses disapproval in his heart.
Ibn ‘Abbas reported God’s Messenger as saying, “If anyone sees in his commander what he dislikes he should show patience, for no one separates a span's distance from the community and dies without dying like those of pre-Islamic times.”