The caliphate as Sunni theory conceived it is an executive and juridical office, not a prophetic one. The caliph defends the territory of Islam, appoints judges, collects and disburses the treasury, leads the pilgrimage and the Friday prayer. He does not receive revelation, which ended with Muhammad; he is not immune from sin or error; and he does not define doctrine, which is the work of the scholars. Religious authority in Sunni Islam accordingly came to rest with the ulama and the schools of law rather than with the ruler, a separation that shaped the whole tradition.
Classical jurists required that the caliph be a free adult male Muslim of the tribe of Quraysh, sane, just and competent, and they differed on whether he must be the most excellent candidate or merely a qualified one, and on what may be done about an unjust caliph. Most concluded that rebellion causes greater harm than tyranny, a doctrine of quietism that reflected the historical reality of Umayyad and Abbasid rule.
The contrast with Shia Islam is the founding disagreement of the religion. Shia doctrine holds that Muhammad designated Ali at Ghadir Khumm, that the Imamate is a divinely conferred office carrying authoritative interpretation of revelation and, in most Shia traditions, immunity from error, and that the first three caliphs therefore held power they had no right to. Sunnis venerate Abu Bakr, Umar and Uthman; ritual cursing of them was practised in some Shia contexts, and remains a point of sectarian friction.
Ibadism offers a third answer, rejecting both hereditary descent and Qurashi requirement in favour of election on merit with a right of deposition. The Ottoman sultans claimed the caliphal title from the sixteenth century; the office was abolished by the Turkish republic in 1924, and the question of whether and how it might be restored has animated Islamist movements ever since.