Abu Hurairah reported,

The Messenger of Allah ﷺ said, "Whoever obeys me has obeyed Allah, and whoever disobeys me has disobeyed Allah. Whoever obeys my appointed leader has obeyed me, and whoever disobeys my appointed leader has disobeyed me."

Azami 12185

Sahih

عن أبي هريرة

أن رسول الله ﷺ قال: من أطاعني فقد أطاع الله، ومن عصاني فقد عصى الله، ومن أطاع أميري فقد أطاعني، ومن عصى أميري فقد عصاني.

الأعظمي 12185صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Tafsir of the great Quran
Chapter
Virtues of Surah Baqarah
Section
His saying, "Whoever obeys the Messenger has obeyed Allah, and whoever turns away, We have not sent you as a guardian over them"
Numbering
Jami al-Kamil 12185 (2nd edition)
Azami 12185