Ibn 'Umar (May Allah be pleased with them) reported:
The Prophet (ﷺ) said, "It is obligatory upon a Muslim to listen (to the ruler) and obey whether he likes it or not, except when he is ordered to do a sinful thing; in such case, there is no obligation to listen or to obey."[Al-Bukhari and Muslim].
Arabic/English book reference: Book 1, Hadith 663