كتاب المقدمات
The Book of Miscellany
(80)
Chapter: Obligation of Obedience to the Ruler in what is Lawful and Prohibition of Obeying them in what is Unlawful
(80)
- باب وجوب طاعة ولاة الأمر في غير معصية وتحريم طاعتهم في المعصية
Riyad as-Salihin 670
Abu Hurairah (May Allah be pleased with him) reported:
Messenger of Allah (ﷺ) said, "Whosoever obeys me, obeys Allah; and he who disobeys me, disobeys Allah; and whosoever obeys the Amir (leader), in fact, obeys me; and he who disobeys the Amir, in fact, disobeys me."

[Al-Bukhari and Muslim].

وعن أبي هريرة رضي الله عنه قال‏:‏ قال رسول الله صلى الله عليه وسلم‏:‏ “من أطاعني فقد أطاع الله، ومن عصاني فقد عصى الله، ومن يطع الأمير فقد أطاعني، ومن يعص الأمير فقد عصاني” ‏(‏‏(‏متفق عليه‏)‏‏)‏ ‏.‏
Reference : Riyad as-Salihin 670
In-book reference : Introduction, Hadith 670