Sahih Muslim Book 020, Hadith Number 4573.
Chapter : The best and the worst of your rulers.
It has been narrated on the authority of 'Auf b. Malik that the Messenger of Allah (may peace be upon him) said: The best of your rulers are those whom you love and who love you, who invoke God's blessings upon you and you invoke His blessings upon them. And 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 present): Shouldn't we overthrow them with the help of the sword? He said: No, as long as they establish prayer among you. If you then find anything detestable in them. You should hate their administration, but do not withdraw yourselves from their obedience.