When the Prophet Muhammad ﷺ died, the community chose Abu Bakr as his successor, or khalifah, to lead them in the affairs of the community. The Prophet ﷺ had said that the prophets of the Children of Israel were followed by prophets, but that there would be no prophet after him, and that there would be caliphs, and he told people to fulfil their pledge to each one in turn. The Quran also describes the community as one whose affairs are decided by consultation. The first four caliphs are known to Sunni Muslims as the rightly guided. Later, the office passed to the Umayyads, the Abbasids and finally the Ottomans, though in practice real power often rested with sultans and local rulers.
After the First World War, the Ottoman Empire was defeated. In 1922 the Turkish national assembly abolished the sultanate, leaving a caliph with only a religious role, and on 3 March 1924 the assembly abolished the caliphate itself and sent the last caliph, Abdulmejid II, into exile. A conference of scholars in Cairo in 1926 discussed whether the office could be restored, and nothing came of it. Since then, the Muslim world has been organised into separate nations. Shia Muslims hold that the Prophet ﷺ designated 'Ali and his descendants as the leaders of the community, so they understand the question of leadership differently.
Muslims differ on what this means today. Some believe that a unified leadership is a religious ideal, and some work for it by peaceful means. Many others argue that the Quran requires consultation and justice, and does not require one particular form of government. In 2014 a violent group declared a so-called caliphate, but it was condemned by the great majority of Muslim scholars and organisations around the world, who pointed out that murder and terror are the opposite of what the office was meant to protect.