We know we have to obey ALLAH swt and HIS messenger s.a.w.w in all matters of life without asking any question because whatever we are told to do it is for our good and whatever we are told to avoid is also for our own good.
ALLAH swt says in Quran
Holy Quran: 4:110
“And whoever does evil or wrongs himself but afterwards seeks Allah's forgiveness, he will find Allah Oft-Forgiving, Most Merciful”
So, we are responsible for all the good we do and all the bad we do, nothing more or less than what we have earned will be added to our account and if we ask for forgiveness then we will be forgiven by the grace of ALLAH swt.
Any way coming to the topic, below are given ahadith that tell us to obey who are either our rulers or our scholars and if they do not go against Quran and sunnah.
Saheeh Muslim: Book 020, Hadith Number 4524.
It has been narrated on the authority of Abu Huraira that the Messenger of Allah (may peace be upon him) said: It is obligatory for you to listen to the ruler and obey him in adversity and prosperity, in pleasure and displeasure, and even when another person is given (rather undue) preference over you.
This hadith says that we have to obey a Muslim ruler in all circumstances even in bad times or even if he gives preference to others over you. This wisdom or logic behind this is that in a state where the public and leaders are not friendly, they become weak and easy prey to the enemy who do not take a min. to destroy such nations.
Similarly in another place MUHAMMAD s.a.w.w said:
Sahih Muslim: Book 020, Hadith Number 4525.
It has been narrated on the authority of Abu Dharr who said: My friend (i.e. the Holy prophet s.a.w.w) advised me to listen (to the man in position of authority) and obey (him) even if he were a slave maimed (and disabled).
And;
Sahih Muslim: Book 020, Hadith Number 4528.
It has been narrated on the authority of Yahya b. Husain who learnt the tradition from his grandmother. She said that she heard the Holy prophet (may peace be upon him) delivering his sermon on the occasion of the Last Pilgrimage. He was saying: If a slave is appointed over you and he conducts your affairs according to the Book of Allah, you should listen to him and obey (his orders).
These two ahadith indicate it clearly, that till the ruler is Muslim and he does not give orders outside Islam he has to be followed to avoid any chaos, because such chaos lead to the weakness of the state.
Then in another hadith (this hadith is found in sahih Muslim in chapter : Instruction to stick to the main body of the Muslims in the time of trials and warning against those inviting people to disbelief.)
), MUHAMMAD s.a.w.w ordered us to stick to the orders of the ruler who is Muslim and does not govern outside Islam by saying that:
Book 020, Hadith Number 4554.
It has been narrated through a different chain of transmitters, on the authority of Hudhaifa b. al-Yaman who said: Messenger of Allah, no doubt, we had an evil time (i.e. the days of Jahiliyya or ignorance) and God brought us a good time (i.e. Islamic period) through which we are now living Will there be a bad time after this good time? He (the Holy Prophet) said: Yes. I said: Will there be a good time after this bad time? He said: Yes. I said: Will there be a bad time after good time? He said: Yes. I said: How? Whereupon he said: There will be leaders who will not be led by my guidance and who will not adopt my ways? There will be among them men who will have the hearts of devils in the bodies of human beings. I said: What should I do.
Messenger of Allah, if I (happen) to live in that time? He replied: You will listen to the Amir and carry out his orders; even if your back is flogged and your wealth is snatched, you should listen and obey.
Therefore even in the times of difficulty and trouble we should follow our deen and should not fall ourselves in trouble.
ALLAH swt says in Quran
Holy Quran: 4:110
“And whoever does evil or wrongs himself but afterwards seeks Allah's forgiveness, he will find Allah Oft-Forgiving, Most Merciful”
So, we are responsible for all the good we do and all the bad we do, nothing more or less than what we have earned will be added to our account and if we ask for forgiveness then we will be forgiven by the grace of ALLAH swt.
Any way coming to the topic, below are given ahadith that tell us to obey who are either our rulers or our scholars and if they do not go against Quran and sunnah.
Saheeh Muslim: Book 020, Hadith Number 4524.
It has been narrated on the authority of Abu Huraira that the Messenger of Allah (may peace be upon him) said: It is obligatory for you to listen to the ruler and obey him in adversity and prosperity, in pleasure and displeasure, and even when another person is given (rather undue) preference over you.
This hadith says that we have to obey a Muslim ruler in all circumstances even in bad times or even if he gives preference to others over you. This wisdom or logic behind this is that in a state where the public and leaders are not friendly, they become weak and easy prey to the enemy who do not take a min. to destroy such nations.
Similarly in another place MUHAMMAD s.a.w.w said:
Sahih Muslim: Book 020, Hadith Number 4525.
It has been narrated on the authority of Abu Dharr who said: My friend (i.e. the Holy prophet s.a.w.w) advised me to listen (to the man in position of authority) and obey (him) even if he were a slave maimed (and disabled).
And;
Sahih Muslim: Book 020, Hadith Number 4528.
It has been narrated on the authority of Yahya b. Husain who learnt the tradition from his grandmother. She said that she heard the Holy prophet (may peace be upon him) delivering his sermon on the occasion of the Last Pilgrimage. He was saying: If a slave is appointed over you and he conducts your affairs according to the Book of Allah, you should listen to him and obey (his orders).
These two ahadith indicate it clearly, that till the ruler is Muslim and he does not give orders outside Islam he has to be followed to avoid any chaos, because such chaos lead to the weakness of the state.
Then in another hadith (this hadith is found in sahih Muslim in chapter : Instruction to stick to the main body of the Muslims in the time of trials and warning against those inviting people to disbelief.)
), MUHAMMAD s.a.w.w ordered us to stick to the orders of the ruler who is Muslim and does not govern outside Islam by saying that:
Book 020, Hadith Number 4554.
It has been narrated through a different chain of transmitters, on the authority of Hudhaifa b. al-Yaman who said: Messenger of Allah, no doubt, we had an evil time (i.e. the days of Jahiliyya or ignorance) and God brought us a good time (i.e. Islamic period) through which we are now living Will there be a bad time after this good time? He (the Holy Prophet) said: Yes. I said: Will there be a good time after this bad time? He said: Yes. I said: Will there be a bad time after good time? He said: Yes. I said: How? Whereupon he said: There will be leaders who will not be led by my guidance and who will not adopt my ways? There will be among them men who will have the hearts of devils in the bodies of human beings. I said: What should I do.
Messenger of Allah, if I (happen) to live in that time? He replied: You will listen to the Amir and carry out his orders; even if your back is flogged and your wealth is snatched, you should listen and obey.
Therefore even in the times of difficulty and trouble we should follow our deen and should not fall ourselves in trouble.