Abu Dawud Book 30, Hadith Number 4236.
Chapter : Fitan and their predictions.
Narated By ‘Abd Allah b. ‘Amr : The Prophet (PBUH) said: If a man takes an oath of allegiance to a leader, and puts his hand on his hand and does it with sincerity of his heart, he should obey him as much as possible. If another man comes and contests him, then behead the other one. The narrator ‘Abd al-Rahman said: I asked: Have you heard this from the Apostle of Allah? He said: My ears heard it and my heart retained it. I said: Your cousin Mu’awiyah orders us that we should do this and do that. He replied: Obey him in acts of obedience to Allah, and disobey him in acts of disobedience to Allah.