The obligation of obeying leaders in matters that do not involve sin, but it is forbidden to obey them in sinful matters Sahih Muslim 1838 d

Arabic hadith text
وَحَدَّثَنَا عَبْدُ الرَّحْمَنِ بْنُ بِشْرٍ، حَدَّثَنَا بَهْزٌ، حَدَّثَنَا شُعْبَةُ، بِهَذَا الإِسْنَادِ وَلَمْ يَذْكُرْ حَبَشِيًّا مُجَدَّعًا وَزَادَ أَنَّهَا سَمِعَتْ رَسُولَ اللَّهِ صلى الله عليه وسلم بِمِنًى أَوْ بِعَرَفَاتٍ
Translation
Another version of the tradition does not qualify the slave with the epithets" maimed,"" an Abyssinian" but makes the addition

" I have heard the Prophet (ﷺ) (say this) at Mina or 'Arafat."