Sahih Muslim Book 20, Hadith Number 4532.

Chapter : Obedience to the ruler is forbidden in matters sinful, but is otherwise obligatory.

It has been narrated on the authority of Yahya b. Husain who learnt the tradition from his grandmother. Umm Husain. He said’: I heard her say: I performed Hajjat-ul-Wada’ in the company of the Messenger of Allah (may peace be upon him). He said a lot of things (on this occasion). Then I heard him say: If a maimed slave is appointed a commander over you the narrator says: I think she said: “a black stave” who leads you according to the Book of Allah, then listen to him and obey him.