The Prophet ﷺ as saying: If a man takes an oath of allegiance to a leader, and puts his hand on his hand and does it with the 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 Messenger 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 the acts of obedience to Allah, and disobey him in the acts of disobedience to Allah.
أَنَّ النَّبِيَّ ﷺ قَالَ مَنْ بَايَعَ إِمَامًا فَأَعْطَاهُ صَفْقَةَ يَدِهِ وَثَمَرَةَ قَلْبِهِ فَلْيُطِعْهُ مَا اسْتَطَاعَ فَإِنْ جَاءَ آخَرُ يُنَازِعُهُ فَاضْرِبُوا رَقَبَةَ الآخَرِ قُلْتُ أَنْتَ سَمِعْتَ هَذَا مِنْ رَسُولِ اللَّهِ ﷺ قَالَ سَمِعَتْهُ أُذُنَاىَ وَوَعَاهُ قَلْبِي قُلْتُ هَذَا ابْنُ عَمِّكَ مُعَاوِيَةُ يَأْمُرُنَا أَنْ نَفْعَلَ وَنَفْعَلَ قَالَ أَطِعْهُ فِي طَاعَةِ اللَّهِ وَاعْصِهِ فِي مَعْصِيَةِ اللَّهِ