The first caliphate, the Rashidun Caliphate, was established immediately after Muhammad's death in 632. The four Rashidun caliphs, who directly succeeded Muhammad as leaders of the Muslim community, were chosen through shura, a process of community consultation that some consider to be an early form of Islamic democracy. The fourth caliph, Ali, who, unlike the prior three, was from the same clan as Muhammad (Banu Hashim), is considered by Shia Muslims to be the first rightful caliph and Imam after Muhammad. Ali reigned during the First Fitna (656–661), a civil war between supporters of Ali and supporters of the assassinated previous caliph, Uthman, from Banu Umayya, as well as rebels in Egypt; the war led to the establishment of the Umayyad Caliphate under Muawiyah I in 661.
The third caliphate, the Abbasid Caliphate was ruled by the Abbasids, a dynasty of Meccan origin which descended from Hashim, a great-grandfather of Muhammad, making them part of Banu Hashim, via Abbas, an uncle of Muhammad, hence the name. Caliph al-Mansur founded its second capital of Baghdad in 762 which became a major scientific, cultural and art centre, as did the territory as a whole during a period known as the Islamic Golden Age. From the 10th century, Abbasid rule became confined to an area around Baghdad. From 945 to 1157, the Abbasid Caliphate came under Buyid and then Seljuq military control. In 1250, a non-Arab army created by the Abbasids called the Mamlukscame to power in Egypt. In 1258, the Mongol Empiresacked Baghdad, ending the Abbasid Caliphate, and in 1261 the Mamluks in Egypt re-established the Abbasid Caliphate in Cairo. Though lacking in political power, the Abbasid dynasty continued to claim authority in religious matters until the Ottoman conquest of Mamluk Egypt in 1517.
The Sunni branch of Islam stipulates that, as a head of state, a caliph was a selected or elected position. Followers of Shia Islam, however, believe a caliph should be an Imam chosen by God from the Ahl al-Bayt (the "Family of the House", Muhammad's direct descendants). In simpler terms, the Sunni favour election while the Shia favour bloodline.
In the early 21st century, following the failure of the Arab Spring and defeat of the self-proclaimed "Islamic State", there has been seen "a broad mainstream embrace of a collective Muslim identity" by young Muslims and the appeal of a caliphate as a "idealized future Muslim state" has grown ever stronger.
Before the advent of Islam, Arabian monarchs traditionally used the title malik(King, ruler), or another from the same root.
The term caliph (f/), derives from the Arabic word khalīfah (خَليفة, pronunciation (help·info)), which means "successor", "steward", or "deputy" and has traditionally been considered a shortening of Khalīfat Rasūl Allāh ("successor of the messenger of God"). However, studies of pre-Islamic texts suggest that the original meaning of the phrase was "successor selected by God".