Sahih Bukhari Volume 4, Book 52, Hadith Number 203.
Narated By Ibn ‘Umar : The ‘Prophet said, “It is obligatory for one to listen to and obey (the ruler’s orders) unless these orders involve one disobedience (to Allah); but if an act of disobedience (to Allah) is imposed, he should not listen to or obey it.”