The obligation of obeying leaders in matters that do not involve sin, but it is forbidden to obey them in sinful matters Sahih Muslim 1837 a
Arabic hadith text
وَحَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، وَعَبْدُ اللَّهِ بْنُ بَرَّادٍ الأَشْعَرِيُّ، وَأَبُو كُرَيْبٍ قَالُوا حَدَّثَنَا ابْنُ إِدْرِيسَ، عَنْ شُعْبَةَ، عَنْ أَبِي عِمْرَانَ، عَنْ عَبْدِ اللَّهِ بْنِ الصَّامِتِ، عَنْ أَبِي ذَرٍّ، قَالَ إِنَّخَلِيلِي أَوْصَانِي أَنْ أَسْمَعَ وَأُطِيعَ وَإِنْ كَانَ عَبْدًا مُجَدَّعَ الأَطْرَافِ .
Translation
It has been narrated on the authority of Abu Dharr who said
My friend (i. e. the Holy Prophet) advised me to listen (to the man in position of authority) and obey (him) even if he were a slave maimed (and disabled).