So the rulers are to be obeyed as required by the Sharee’ah if they command that which is not contrary to the Command of Allaah and His Messenger. This is because the duty upon the people is to hear and obey when the ruler commands that which is not contrary to the Command of Allaah and His Messenger. In this situation and with this condition, their obedience to those in authority is obedience to Allaah (Azza wa Jal).
For this reason, we should bear in mind that when we carry out what the state authority has ordered from matters in which it must be obeyed, we are, in this respect, worshipping Allaah, The Most High, and drawing closer to Him through this obedience. So, bearing this in mind, our execution of the ruled matter will be something that draws us closer to Allaah, The Mighty and Majestic. It is something that we should be conscious of; because Allaah, The Most High, Says:
O you who believe, obey Allaah, and obey his Messenger, and those of you in authority.
[Qur’aan, soorat an-Nisaa’ (4): 59].
Translated by Dr Saleh as Saleh rahimahullaah
Source : Understanding Worship – Fiqh ul-‘Ibadah – Shaykh ibn Uthaymeen – Page 135