‘Ali (Allaah be pleased with him) said “The Messenger of Allah ﷺ sent an army and appointed a man as a commander for them and he commanded them to listen to him and obey. He kindled fire and ordered them to jump into it. A group refused to enter into it and said “We escaped from the fire; a group intended to enter into it. When the Prophet ﷺ was informed about it, he said “Had they entered into it, they would have remained into it. There is no obedience in matters involving disobedience to Allaah. Obedience is in matters which are good and universally recognized.
أَنَّ رَسُولَ اللَّهِ ﷺ بَعَثَ جَيْشًا وَأَمَّرَ عَلَيْهِمْ رَجُلاً وَأَمَرَهُمْ أَنْ يَسْمَعُوا لَهُ وَيُطِيعُوا فَأَجَّجَ نَارًا وَأَمَرَهُمْ أَنْ يَقْتَحِمُوا فِيهَا فَأَبَى قَوْمٌ أَنْ يَدْخُلُوهَا وَقَالُوا إِنَّمَا فَرَرْنَا مِنَ النَّارِ وَأَرَادَ قَوْمٌ أَنْ يَدْخُلُوهَا فَبَلَغَ ذَلِكَ النَّبِيَّ ﷺ فَقَالَ لَوْ دَخَلُوهَا أَوْ دَخَلُوا فِيهَا لَمْ يَزَالُوا فِيهَا وَقَالَ لاَ طَاعَةَ فِي مَعْصِيَةِ اللَّهِ إِنَّمَا الطَّاعَةُ فِي الْمَعْرُوفِ