Hadith 3665
Mishkat al-Masabih
The Offices of Commander and Qadi · Section 1
Arabic
وَعَنْ عَلِيٍّ رَضِيَ اللَّهُ عَنْهُ قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «لَا طَاعَةَ فِي مَعْصِيَةٍ إِنَّمَا الطَّاعَةُ فِي الْمَعْرُوف»
English translation
‘Ali reported God’s Messenger as saying, “No obedience is to be given in the case of an act of disobedience to God, obedience is to be given only regarding what is reputable.” (Bukhari and Muslim.)