Sahih al-Bukhari 7145
Narrated 'Ali:
The Prophet sent an army unit (for some campaign) and appointed a man from the Ansar as its commander and ordered them (the soldiers) to obey him. (During the campaign) he became angry with them and said, "Didn't the Prophet order you to obey me?" They said, "Yes." He said, "I order you to collect wood and make a fire and then throw yourselves into it." So they collected wood and made a fire, but when they were about to throw themselves into, it they started looking at each other, and some of them said, "We followed the Prophet to escape from the fire. How should we enter it now?" So while they were in that state, the fire extinguished and their commander's anger abated. The event was mentioned to the Prophet and he said, "If they had entered it (the fire) they would never have come out of it, for obedience is required only in what is good." (See Hadith No. 629. Vol. 5)
حَدَّثَنَا عُمَرُ بْنُ حَفْصِ بْنِ غِيَاثٍ، حَدَّثَنَا أَبِي، حَدَّثَنَا الأَعْمَشُ، حَدَّثَنَا سَعْدُ بْنُ عُبَيْدَةَ، عَنْ أَبِي عَبْدِ الرَّحْمَنِ، عَنْ عَلِيٍّ ـ رضى الله عنه ـ قَالَ بَعَثَ النَّبِيُّ ﷺ سَرِيَّةً، وَأَمَّرَ عَلَيْهِمْ رَجُلاً مِنَ الأَنْصَارِ وَأَمَرَهُمْ أَنْ يُطِيعُوهُ، فَغَضِبَ عَلَيْهِمْ وَقَالَ أَلَيْسَ قَدْ أَمَرَ النَّبِيُّ ﷺ أَنَّ تُطِيعُونِي قَالُوا بَلَى. قَالَ عَزَمْتُ عَلَيْكُمْ لَمَا جَمَعْتُمْ حَطَبًا وَأَوْقَدْتُمْ نَارًا، ثُمَّ دَخَلْتُمْ فِيهَا، فَجَمَعُوا حَطَبًا فَأَوْقَدُوا، فَلَمَّا هَمُّوا بِالدُّخُولِ فَقَامَ يَنْظُرُ بَعْضُهُمْ إِلَى بَعْضٍ، قَالَ بَعْضُهُمْ إِنَّمَا تَبِعْنَا النَّبِيَّ ﷺ فِرَارًا مِنَ النَّارِ، أَفَنَدْخُلُهَا، فَبَيْنَمَا هُمْ كَذَلِكَ إِذْ خَمَدَتِ النَّارُ، وَسَكَنَ غَضَبُهُ، فَذُكِرَ لِلنَّبِيِّ ﷺ فَقَالَ " لَوْ دَخَلُوهَا مَا خَرَجُوا مِنْهَا أَبَدًا، إِنَّمَا الطَّاعَةُ فِي الْمَعْرُوفِ ".