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

Arabic hadith text
وَحَدَّثَنَاهُ ابْنُ نُمَيْرٍ، حَدَّثَنَا عَبْدُ اللَّهِ، - يَعْنِي ابْنَ إِدْرِيسَ - حَدَّثَنَا ابْنُ عَجْلاَنَ، وَعُبَيْدُ اللَّهِ بْنُ عُمَرَ وَيَحْيَى بْنُ سَعِيدٍ عَنْ عُبَادَةَ بْنِ الْوَلِيدِ، فِي هَذَا الإِسْنَادِ مِثْلَهُ ‏.‏
Translation

This hadith has been narrated on the authority of 'Ubada b. Walid with the same chain of transmitters.