Historically, the institution of Khilafat emerged within the early Muslim community with the election of Hadhrat Abu Baker Siddiq (ra) as Khalifatul Rasul after the death of the Holy Prophet Muhammad (sa). In the history of Islam, there has been three types of Khulafa. Like, mentioned above, the early Khulafa/Caliphs who upheld the faith and its values with sincere and complete devotion after having been taught by the Holy Prophet (sa) himself and they having spent their lives as his companions during the lifetime of the Holy Prophet (sa). These caliphs- Hadhrat Abu Baker Siddiq (ra), Hadhrat Umar (ra), Hadhrat Uthman (ra) and Hadhrat Ali (ra)- are collectively known as the rightly-guided caliphs-Khulafa-ur-Rashidun.
The second type of Khulafa are those who came after these pious caliphs. Those who came after the Khulafa-ur-Rashidun were also leaders of the Muslim Ummah, having sovereignty and political authority over the nation. While many of them practiced their religion as they understood their faith, but the Ummah in general do not consider them to be spiritual models, to be emulated like the early exemplars. They were a manifestation of the material glory of the Ummah as a political and religious community as against the other-worldly preoccupations of true saints and believers.
The third type of Khulafa are the Divine Reformers or Mujaddidin who appeared in different lands of Islam at different points of time, in the history of Islam. They were the spiritual deputies of the Holy Prophets (sa) who were Divinely-raised, with revelations, inspirations, visions and dreams to guide the Ummah and to be the practical models of a living Islam in their respective communities. As per the Islamic tradition, Allah (swa) will raise a Mujaddid at the turn of every century to preserve the true spirit of Holy Qur'an and the Islamic teachings among the believers and this Divine scheme will continue to serve the spiritual purpose till the Day of Judgement. As these men are Divinely-ordained, they are also known as Khalifatullah or the Vicegerent of Allah. Hence, one of the titles of the Promised Massih (as) is as Khalifatullah.