إِنَّمَا كَانَ قَوْلَ الْمُوْمِنِينَ إِذَا دُعُوا إِلَى اللَّهِ وَرَسُولِهِ لِيَحْكُمَ بَيْنَهُمْ أَن يَقُولُوا سَمِعْنَا وَأَطَعْنَا
The only saying of the faithful believers, when they are called to Allah and His Messenger, to judge between them, is that they say;"We hear and we obey".
meaning, to hear to obey. Allah describes them as having attained success, which is achieving what one wants and being saved from what one fears.
So Allah says;
وَأُوْلَيِكَ هُمُ الْمُفْلِحُونَ
And such are the successful.
Concerning the Ayah;
أَن يَقُولُوا سَمِعْنَا وَأَطَعْنَا
(they say;"We hear and we obey".), Qatadah said;
"We were told that when Ubadah bin As-Samit, who had been present at Al-Aqabah and at Badr, and was one of the leaders of the Ansar, was dying, he said to his nephew Junadah bin Abi Umayyah;`Shall I not tell you what you must do and what is your due!'
He said, `Yes.'
He said;
`You have to listen and obey when times are easy and when they are hard, when you feel energetic and when you do not want to, and when you feel selfish.
You have to train your tongue to speak the truth.
Do not go against those who are in authority, unless they openly command you to commit acts of disobedience to Allah.
Whenever you are commanded to do something that goes against the Book of Allah, then follow the Book of Allah."'
Qatadah said;We were told that Abu Ad-Darda' said,
"There is no Islam except through obedience to Allah, and no goodness except in Jama`ah.
Sincerity is to Allah and His Messenger, and to the Khalifah and all the believers."
He said;"And we were told that Umar bin Al-Khattab, may Allah be pleased with him, used to say;
`The bonds of Islam are
La ilaha illallah,
establishing prayer,
paying Zakah and
obeying those whom Allah has given authority over the affairs of the Muslims."'
This was recorded by Ibn Abi Hatim.
There are very many Hadiths and reports which state that it is obligatory to;
obey the Book of Allah,
the Sunnah of His Messenger,
the Rightly-Guided Khalifahs and the Imams when they command us to obey Allah;
there are too many of these reports to quote them all here