Sahih Muslim Book 20, Hadith Number 4604.

Chapter : Swearing fealty for listening to and obeying the orders of the leader as far as possible.

It has been narrated on the authority of Abdullah b. ‘Umar who said: We used to take oath to the Messenger of Allah (may peace be upon him) that we would listen to and obey his orders. He would tell us (to say in the oath): As far as it lies in my power.