Abu Hurairah (May Allah be pleased with him) reported:
Messenger of Allah (ﷺ) said, "The Banu Isra'il were ruled by the Prophets. When one Prophet died, another succeeded him. There will be no Prophet after me. Caliphs will come after me, and they will be many." The Companions said: "O Messenger of Allah, what do you command us to do?" He said, "Fulfill the pledge of allegiance to which is sworn first (then swear allegiance to the others). Concede to them their due rights and ask Allah that which is due to you. Allah will call them to account in respect of the subjects whom He had entrusted to them."[Al-Bukhari and Muslim].
Arabic/English book reference: Book 1, Hadith 656