The Mahdi (Arabic: , ISO 233: al-mahd?y, meaning "the Rightly Guided One" is an eschatological Messianic figure who, according to Islamic belief, will appear at the end of times to rid the world of evil and injustice. In Muslim traditions, it is said that he will appear alongside Jesus Christ and establish the Divine kingdom of God. His reign will last 6, 7 or 9 years according to different sources. 
There is no direct reference to the Mahdi in the Quran, only in the hadith (the reports and traditions of Muhammad's teachings collected after his death). In most traditions, the Mahdi will arrive with 'Isa (Jesus) to defeat Al-Masih ad-Dajjal ("the false Messiah", or Antichrist). Although the concept of a Mahdi is not an essential doctrine in Sunni Islam, it is popular among both Sunni and Shia Muslims. Both agree that he will rule over Muslims and establish justice; however, they differ extensively on his attributes and status.
Throughout history, various individuals have claimed to be or were proclaimed to be the Mahdi. These have included Muhammad Jaunpuri, founder of the Mahdavia sect; the Báb (Siyyid Ali Muhammad), founder of Bábism; Muhammad Ahmad, who established the Mahdist State in Sudan in the late 19th century; Mirza Ghulam Ahmad, founder of the Ahmadiyya movement; Massoud Rajavi, leader of the MEK, Riaz Ahmed Gohar Shahi, and Wallace Fard Muhammad, founder of the Nation of Islam.
Shi'ites have alternate views on which descendant of the Islamic Nabi (Prophet) Muhammad is the Mahdi. Twelvers, who form the majority of Shi'ites today, believe that Muhammad al-Mahdi who is the son of the 11th Imam Al-Hasan al-Askari is in occultation and is the awaited Mahdi. Tayyibi Isma'ili Shi'ites, including the Dawoodi Bohrah, believe that an Imam from the progeny of At-Tayyib Abu'l-Qasim is the current hidden Imam and Mahdi. The Baha'i Faith believes the Báb was the Mahdi, the spiritual return of the twelfth Shia Imam.
The term Mahdi does not occur in the Quran. It is derived from the Arabic root h-d-y (?-?-?), commonly used to mean "divine guidance". The term al-Mahdi was employed from the beginning of Islam, but only as an honorific epithet and without any messianic significance. As an honorific it has been used in some instances to describe Muhammad (by Hassan ibn Thabit), as well as Abraham, al-Husayn, and various Umayyad rulers (hud?t mahd?y?n). During the second civil war (680-692), after the death of Mu?awiya, the term acquired a new meaning of a ruler who would restore Islam to its perfect form and restore justice after oppression. In Kufa during the rebellion in 680s, Al-Mukhtar proclaimed Muhammad al-Hanafiyyah as the Mahdi in this heightened sense. Among the Umayyads, caliph Sulayman ibn Abd al-Malik encouraged the belief that he was the Mahdi, and other Umayyad rulers, like Umar II, have been addressed as such in the panegyrics of Jarir and al-Farazdaq.
Early discussions about the identity of al-Mahdi by religious scholars can be traced back to the time after the Second Fitna. These discussions developed in different directions and were influenced by traditions (hadiths) attributed to Muhammad. In Umayyad times, scholars and traditionists not only differed on which caliph or rebel leader should be designated as Mahdi, but also on whether the Mahdi is a messianic figure and if signs and predictions of his time have been satisfied. By the time of the Abbasid Revolution in the year 750, Mahdi was already a known concept. Evidence shows that the first Abbasid caliph As-Saffah assumed the title of "the Mahdi" for himself.
In Shia Islam, it seems likely that the attribution of messianic qualities to the Mahdi originated from two of the groups supporting al-Hanafiyyah: southern Arabian settlers and local recent converts in Iraq. They became known as Kaysanites, and introduced what later became two key aspects of the Shia's concept of the Mahdi. The first was the notion of return of the dead, particularly of the Imams. The second was that after al-Hanafiyyah's death they believed he was, in fact, in hiding in the Razwa mountains near Medina. This later developed into the doctrine known as the occultation. The Mahdi appeared in early Shi'ite narratives, spread widely among Shi'ite groups and became dissociated from its historical figure, Muhammad al-Hanafiyyah. During the 10th century, based on these earlier beliefs, the doctrine of Mahdism was extensively expanded by Al-Kulayni, Ibrahim al-Qummi and Ibn Babawayh. In particular, in the early 10th century, the doctrine of the occultation, which declares that the Twelfth Imam did not die but was concealed by God from the eyes of men, was expounded. The Mahdi became synonymous with the "Hidden Imam" who was thought to be in occultation awaiting the time that God has ordered for his return. Muhammad said: "I swear by Him Who sent me with the truth as a bearer of glad tidings, the Qaim from my offspring will surely become concealed from public view on the basis of a covenant that has been entrusted to him from me,This return is envisaged as occurring shortly before the final Day of judgment. In fact, the concept of the "hidden Imam" was attributed to several Imams in turn.
Some historians suggest that the term itself was probably introduced into Islam by southern Arabian tribes who had settled in Syria in the mid-7th century. They believed that the Mahdi would lead them back to their homeland and reestablish the Himyarite kingdom. They also believed that he would eventually conquer Constantinople. It has also been suggested that the concept of the Mahdi may have been derived from messianic Judeo-Christian beliefs. Accordingly, traditions were introduced to support certain political interests, especially Anti-Abbassid sentiments. These traditions about the Mahdi appeared only at later times in hadith collections such as Jami' at-Tirmidhi and Sunan Abi Dawud, but are absent from the early works of Bukhari and Muslim.
Since Sunnism has no established doctrine of Mahdi, compositions of Mahdi varies among Sunni scholars. While some scholars like Ibn Khaldun even disputed the authenticity of references concerning the Mahdi in hadith literature, others like Ibn Kathir elaborated a whole apocalyptic scenario which included prophecies about Mahdi, Jesus and Dajjal during the endtime. Some Sunni beliefs deny the Mahdi as a separate figure, accordingly Jesus will fulfill this role and judge over mankind, thus Mahdi is considered as a title for Jesus, when he returns. However the more common opinion among Sunni Muslims is, that the Mahdi is an expected ruler sent by God before the endtime to reestablish righteousness, coincides with the Second Coming of Jesus Christ (Isa), but, unlike most Shia traditions, Sunni Islam often do not believe the Mahdi has already been born. Sunnis in general reject the Twelver Shi'ite principle of the Mahdi's occultation. Sunnis do, however, rely on traditionally canonical collections of narrations for derivations of the Mahdi's attributes and lineage. According to Sunan Abi Dawud, one of the six canonical books of Hadith in Sunni Islam, narrated by Umm Salamah, "The Prophet said: The Mahdi will be of my family, of the descendants of Fatimah." 
In heavy contrast with Shia Islam, Sunnis have a much more human view of the Mahdi, who they believe will be nothing less than the most rightly guided Muslim of his time. He will be rectified in a single night (which is taken to mean that the provisions for his leadership and rule will be made in a single night). According to Sunan Ibn Majah, one of the six canonical collections of Hadith, narrated by 'Ali, "Mahdi is one of us, the people of the Household. Allah will rectify him in a single night." According to Sunan Abi Dawud, "The Prophet said: The Mahdi will be of my stock, and will have a broad forehead [and] a prominent nose. He will fill the earth with equity and justice as it was filled with oppression and tyranny, and he will rule for seven years."
This article relies too much on references to primary sources. (November 2017) (Learn how and when to remove this template message)
The Mahdi is frequently mentioned in Sunni hadith as establishing the caliphate. Among Sunnis, some[who?] believe the Mahdi will be an ordinary man. The following Sunni hadith make references to the Mahdi:
His name will be my name, and his father's name my father's name
Even if the entire duration of the world's existence has already been exhausted and only one day is left before Doomsday, Allah will expand that day to such length of time as to accommodate the Caliphate of a person from my Ahlul-Bayt who will be called by my name. He will fill out the earth with peace and justice as it will have been full of injustice and tyranny (by then).The Quranic verse 16:36 accomplishes this hadith, clearly indicating that the earth was never left without a messenger or a guide.
His [the Mahdi's] aim is to establish a moral system from which all superstitious faiths have been eliminated. In the same way that students enter Islam, so unbelievers will come to believe.
The Messenger of Allah said: "He is one of us".
The Messenger of Allah said: "At the end of the time of my ummah, the Mahdi will appear. Allah will grant him rain, the earth will bring forth its fruits, he will give a lot of money, cattle will increase and the ummah will become great. He will rule for seven or eight years.
The Mahdi is from my Ummah; he will be born and live to rule five or seven or nine years. (If) one goes to him and says, "Give me (a charity)", he will fill one's garment with what one needs.
The face of the Mahdi shall shine upon the surface of the Moon.
His forehead will be broad and his nose will be high, his face will shine like a star and he will have a black spot on his left cheek.
The ahadith that are relied upon as hujjah (proof) for the coming out of the Mahdi are sahih ahadith.
The Mahdi will be from the blood and flesh of the Messenger, and "will rule by kingdom". He will be "sent" by Allah to reduce oppression and injustice on the earth to the barest minimum. He will rule the whole planet as a just, righteous and rightly guided royal khalifah, assisted by his Lord.
Sunni poets Jarir ibn Atiyah and Al-Farazdaq considered various Umayyads Caliphs, such as Sulayman ibn Abd al-Malik, Umar II, Yazid II, and Hisham ibn Abd al-Malik to be the Mahdis. In Medina, among Sunni religious circles, the belief in Umar II being the Mahdi, "the just restorer of religion", was widespread. Said ibn al-Musayyib is said to identify Umar II as the Mahdi long before his reign. The Basran, Abu Qilabah, supported the view that Umar II was the Mahdi. Hasan al-Basri opposed the concept of a Muslim Messiah but believed that if there was the Mahdi, it was Umar II. After the Umayyads, Sunnis held numerous Abbasid Caliphs to be the Mahdis.
A typical modernist in his views on the Mahdi, Abul Ala Maududi (1903-1979), the Pakistani Islamic revivalist, stated that the Mahdi will be a modern Islamic reformer/statesman, who will unite the Ummah and revolutionise the world according to the ideology of Islam, but will never claim to be the Mahdi, instead receiving posthumous recognition as such.In 2011 it is reported that a film was made starring President of Iran Ahmadinejad in which it is proclaimed the 12th Mahdi will come again 
Javed Ahmad Ghamidi writes in his book Mizan:
Besides these, the coming of the Mahdi and that of Jesus from the heavens are also regarded as signs of the Day of Judgment. I have not mentioned them. The reason is that the narratives of the coming of the Mahdi do not conform to the standards of hadith criticism set forth by the muhaddithun. Some of them are weak and some fabricated; no doubt, some narratives, which are acceptable with regard to their chain of narration, inform us of the coming of a generous caliph; (Muslim, No: 7318) however, if they are deeply deliberated upon, it becomes evident that the caliph they refer to is Umar ibn Abd al-Aziz who was the last caliph from a Sunni standpoint. This prediction of the Prophet has thus materialized in his personality, word for word. One need not wait for any other Mahdi now.
Ahmed Hulusi interpreted the Mahdi as a part of the inner self. Therefore, the Mahdi awakes in a person to defeat the inner Dajjal. The Mahdi stands for attaining selflessness and realizing a person's own existence as a part of God.
In Twelver belief, the Mahdi is the twelfth and last in the chain of the Purified Imams. He was born on the 15th of Shaban 255 A.H. His name is Muhammad and titles are Mahdi, Hujjat, Qaim, Muntazar, Sahibuzzaman, and Khalaf al-Saleh, among others, the same names and agnomen of the Islamic Prophet Muhammad. His birth was kept secret as the tyrant Abbasid ruler had planned to eliminate him, being aware of the fact that a person will be born in the family of the prophet who will appear to remove all types of corruption and tyranny. Except for the most trusted of the shias and his own family, no one knew of his existence. At the age of five, after the death of Hasan Askari the eleventh Imam, the responsibility of guiding the Shias (ie Imamat) was transferred upon him, in the same way as Prophet Yahya and Prophet Isa who were favoured by prophethood in their infancy.. Due to various efforts of the enemies to eliminate him, he was entrusted to occultation, which consist of two phases, one is short and the other is prolonged  According to Twelver Shias, the main goal of the Mahdi will be to establish an Islamic state and to apply Islamic laws that were revealed to Muhammad. The Mahdi is believed to be the Twelfth Imam, Hujjat-Allah al-Mahdi. They believe that the Twelfth Imam will return from the occultation as the Mahdi with "a company of his chosen ones," and his enemies will be led by the Dajjal and the Sufyani. The two armies will fight "one final apocalyptic battle" where the Mahdi and his forces will prevail over evil.Both the shia and sunni strongly believe that Isa (Jesus) will return after the Mahdi has arrived.
For Twelvers, the Mahdi was born but disappeared, and would remain hidden from humanity until he reappears to bring justice to the world, a doctrine known as the Occultation. For them, this Imam in occultation is Hujjat-Allah al-Mahdi, the Twelfth Imam. Shia Quran commentators such as Shaikh Tabarsi in his book Majma' al-Bayan have interpreted nine verses referring to the Mahdi in the Quran; and Muhammaed Hussain Tabatabai in book Tafsir al-Mizan have interpreted nine verses referring to the Mahdi in the Quran (eight of them are the same as those interpreted by Shaykh Tabarsi).
Twelver Shi'ites (as the main branch of Shia, which consists of 85% of all Shia Muslims) claim that the Imam al-Mahdi, who went into occultation around 256/873-874, is the promised Mahdi, who will appear before the day of Judgement, to restore justice and equity on earth. In Shia Islam, the Mahdi is associated with the belief in the occultation, that the Mahdi is a "hidden Imam" who has already been born and who will one day return alongside Jesus to fill the world with justice. The promised Mahdi, who is usually mentioned in Shia Islam by his title of Imam-Al-Asr (the Imam of the "Period") and Sahib al-Zaman (the Lord of the Age), is the son of the eleventh Imam. His name is the same as that of the Prophet of Islam. According to Shia Islam, Mahdi was born in Samarra in 868 and until 872 when his father was martyred, lived under his father's care and tutelage. He was hidden from public view and only a few of the elite among the Shi'ah were able to meet him.
Belief in the messianic Imam is not merely a part of the Twelver creed, but the foundation. Shias believe that after the martyrdom of his father he became Imam and by Divine Command went into occultation (ghaybat). Thereafter he appeared only to his deputies (na'ib) and even then only in exceptional circumstances. In their perspective, the Mahdi appointed personal deputy Uthman ibn Sa'id 'Umari, one of the companions of his father and grandfather who was his confidant and trusted friend. Through his deputy Mahdi would answer the demands and questions of the Shias. After Uthman ibn Sa'id, his son Muhammad ibn Uthman Umari was appointed the deputy of him. After the death of Muhammad ibn Uthman, Abu'l Qasim Husayn ibn Ruh Nawbakhti was the special deputy, and after his death Ali ibn Muhammad Simmari was chosen for this task. A few days before the death of Ali ibn Muhammad Sammari in 939 CE, an order was issued by the Mahdi, stating that in six days, Ali would die. Henceforth the special deputation of the Imam would come to an end and the major occultation (ghaybat-i kubra) would begin and would continue until the day God grants permission to the Imam to manifest himself. In the Twelver view, the occultation of Mahdi is, therefore, divided into two parts: the first, the minor occultation (ghaybat-i sughra) which began in 872 and ended in 939, lasting about seventy years; the second, the major occultation which commenced in 939 and will continue as long as God wills it. In a hadith upon whose authenticity Shia and Sunni agree, Muhammad has said, "If there were to remain in the life of the world but one day, God would prolong that day until He sends in it a man from my community and my household. His name will be the same as my name. He will fill the earth with equity and justice as it was filled with oppression and tyranny." 
The Twelver Shia believe that the arrival of the Mahdi will be signalled by the following portents:
Shia traditions also state that the Mahdi be "a young man of medium stature with a handsome face" and black hair and beard. "He will not come in an odd year [...] will appear in Mecca between the corner of the Kaaba and the station of Abraham and people will witness him there.
This article relies too much on references to primary sources. (November 2017) (Learn how and when to remove this template message)
The dominion (authority) of the Mahdi is one of the proofs that God has created all things; these are so numerous that his [the Mahdi's] proofs will overcome (will be influential, will be dominant) everyone and nobody will have any counter-proposition against him.
People will flee from him [the Mahdi] as sheep flee from the shepherd. Later, people will begin to look for a purifier. But since they can find none to help them but him, they will begin to run to him.
When matters are entrusted to competent [the Mahdi], Almighty God will raise the lowest part of the world for him, and lower the highest places. So much that he will see the whole world as if in the palm of his hand. Which of you cannot see even a single hair in the palm of his hand?
In the time of the Mahdi, a Muslim in the East will be able to see his Muslim brother in the West, and he in the West will see him in the East.
The Master of the Command was named as the Mahdi because he will dig out the Torah and other heavenly books from the cave in Antioch. He will judge among the people of the Torah according to the Torah; among the people of the Gospel according to the Gospel; among the people of the Psalms in accordance with the Psalms; among the people of the Qur'an in accordance with the Qur'an.
Abu Bashir says: When I asked Imam Ja'far al-Sadiq, "O son of the Messenger of God! Who is the Mahdi (qa'im) of your clan (ahl al-bayt)?", he replied: "The Mahdi will conquer the world; at that time the world will be illuminated by the light of God, and everywhere in which those other than God are worshipped will become places where God is worshiped; and even if the polytheists do not wish it, the only faith on that day will be the religion of God.
Sadir al-Sayrafi says: I heard from Imam Abu Abdullah Ja'far al-Sadiq that: Our modest Imam, to whom this occultation belongs [the Mahdi], who is deprived of and denied his rights, will move among them and wander through their markets and walk where they walk, but they will not recognize him.
Abu Bashir says: I heard Imam Muhammad al-Baqr say: "He said: When the Mahdi appears he will follow in the path of the Messenger of God. Only he [the Mahdi] can explain the works of the Messenger of God.
The face of the Mahdi shall shine upon the surface of the Moon.
Additionally, there are differences in hadiths regarding the day of the uprising of the Mahdi. Nawroz and Ashura both are considered to be specified for the day of the uprising. According to Ja'far al-Sadiq, the Mahdi will appear on a Friday. His father, Muhammad al-Baqir, also emphasized on the day of Ashura being the day of the uprising, and that his reappearance will be announced from the heavens, after which the Mahdi will lean against the wall of the Kaaba, and invite the people towards truth. Muhammad al-Baqir narrated that Mahdi would appear after the night prayers, and that he would possess a banner and shirt of the Islamic Prophet Mohammad with him.
The Shia strongly believe that the prolonged lifespan of Mahdi is thoroughly justified according to rational, Quranic, traditional, research-based and historical accounts. In this regard, some reasons will be expressed:
Before this, We wrote in the Psalms, after the Message (given to Moses): My servants, the righteous, shall inherit the earth."2 [Yusuf Ali 21:105] This verse was mentioned in the Quran as well as the Torat and Plasms. The righteous servants mentioned referred to as Mahdi and his companions.
Who belief in the Unseen, are steadfast in prayer, and spend out of what We have provided for them; 19[2:3] Those who believe in the occultation of the Mahdi are indicated as the believers of the unseen.
If thou couldst but see when they will quake with terror; but then there will be no escape(for them), and they will be seized from a position (quite) near.24 [34:51] Allama Tabatabai in his book Tafsir al Mizan relates the above verse to the Prophet's hadith indicating the uprising of the Sufyani. He will spread oppression and tyranny on the earth. He and his followers will be swallowed by the earth in the desert of Bayda.
And there is none of the People of the Book but must believe in him before his death and on the Day of Judgment he will be a witness against them; [4:159] In his book Tafsir al Mizan, Allama Tabatabai interprets, the verse regarding the descend of Isa after the reappearance of Mahdi. All the Christians and the Jews will accept Islam as their religion.
It is He Who has sent His Messenger with Guidance and the Religion of Truth, to proclaim it over all religion: and enough is Allah for a Witness.59 [48:28] Through development and spreading peace all over the earth, Mahdi will make Islam dominant over all religions
Soon after the reappearance of Mahdi Isa (Jesus) will also descend from the Heavens. Isa will be like the minister of the Mahdi. Both will work on the common mission of spreading peace, justice, and equality.
"Among my progeny is the Mahdi. When he emerges, Jesus the son of Mary will descend to help him, then Jesus will send him ahead and pray behind him.". This hadith from Prophet Muhammad indicates the return of Jesus, after the reappearance of Mahdi. According to some narrations, Isa will be a just ruler. He will revoke the Jizyah (the annual tax). People will be wealthy and no one would accept charity.
Muhammad al-Baqir said: Mahdi will not rise up except at a time full of fear and dread. Prophet Muhammad said, "After me the caliphate will rule; after the caliphs, the emirs will come, followed by kings, and after them tyrants and oppressors will rule, then the Mahdi will reappear."
Muhammad, in one of his hadith, narrates the religious condition of Islam saying that it will be such that Muslims will be Muslims just for namesake, people will not recognize God and people will not know what is monotheism. Mosques will loose their importance. More attention will be given to the beautification of the structure devoid of the main aim of providing guidance and enlightenment. The plight of religion will be such that it will be sold at a miserable price. Believers in the morning will turn into infidels by evening.
The social condition would be such that the powerful will oppress the weaker. People will be afflicted by immodesty and family insecurities. Even the most inhumane behavior will not be considered as indecent and gradually will become a normal act. People will be encouraged to have fewer children due to economic problems and lack of facilities. The number of women will exceed the number of men. The hadith of Muhammed says in this regard, "Men will die and women will remain." The aggressive and dominant powers of the world will cause insecurity to the weaker nations and their rights will be violated.
Horrifying crimes such as executing young boys, burning children by dipping them into molten liquids, cutting human beings into pieces by axes and iron saws, molesting women, and killing the fetus by slitting their wombs, will be committed under the watchful eyes of the so-called superpower countries.
People would wish for death upon seeing the brutality of each other. One of the companions of the prophet narrates a hadith in this regard "Verily, a time shall come upon you when man will wish for his death although he would not be under the pressure of poverty and indigence." Slavery will prevail. Epidemics may occur frequently. Before the advent of Mahdi 'Red Death and White Death' may occur frequently. Red Death refers to war killings and White death means a plague. The whole of the world would be in despair and disappointment and people would not find any place to take refuge. A hadith of Muhammad al Baqir the fifth Imam of the Twelver Shias indicates the truth about the situation. "You will not see him while waiting for him except at the time when you become like a dead she-goat under the clutches of a fierce animal for which it makes no difference how she was brought. At that time there would be neither a place away from aggression where you could go nor a sanctuary where you could seek refuge".
Before the reappearance of the Mahdi, mass killings will increase and bloodshed and usurpation of the property will be regarded as lawful. The whole of the world will be afflicted by the war in such a way that while it subsides in a certain area, it will ablaze in another area. According to a hadith of Muhammad, no one would be free from the sedition of the end times. It would start from Syria turning towards Iraq spreading to the whole of the Arabian peninsula. A hadith from [Ali] adds in this regard, "Mahdi will not appear unless one-third of the people are killed; another one-third die, and the remaining one-third survive." A number of people will die due to contagious diseases caused by chemicals and biological weapons used in the war.
With frequent wars, corruption, and bad governance, the economic condition will globally decline. Scarce and untimely rains will affect agriculture. Fruits and crops will be destroyed. Water bodies may dry up leading to famine. Due to the lack of agricultural products, a recession in trade will prevail. Inflation will rise, leading to the inadequacy of income. The condition of poverty and starvation will be such that people will barter their daughters and wives in exchange for a small amount of food.
The Isml? developed their own theory of the Mahdi with select Isml? Imams representing the concept of Mahdi or Al-Qa'im (person) at various times. For the Sevener Isml?, the Im?mate ended with Isma'il ibn Ja'far, whose son Muhammad ibn Ismail was the expected Mahdi that Ja'far al-Sadiq had preached about. However, at this point the Isml? Im?ms according to the Nizari and Musta'li found areas where they would be able to be safe from the recently founded Abbasid Caliphate, which had defeated and seized control from the Umayyads in 750 CE. During the period of Ja'far, the Abbasid Caliphate replaced the Umayyads and began to aggressively oppose belief in an Imamate. Due to strong suppression by the Abbasids, the seventh Isml? Imam, Muhammad ibn Ismail, went into a period of occultation. During this period his representative, the D, maintained the community. The names of the eighth, ninth, and tenth Imams are considered by some traditions to be "hidden", known only by their nicknames due to threats from the Abbasids.
The 11th Imam, Abdullah al-Mahdi Billah, founded the Fatimid Caliphate in 909 CE in Ifriqiya (which includes present Tunisia in North Africa), ending the first occultation. In Isml? eyes this act again united the Imamate and the Caliphate in one person. The Fatimids then extended up to the central Maghreb (now including Morocco, Algeria and Libya). They entered and conquered Egypt in 969 CE during the reign of the fourteenth Imam, al-Mu'izz li-Din Allah, and made Cairo their capital. After the eighteenth Imam, al-Mustansir Billah, the Nizari sect believed that his son Nizar was his successor, while another Isml? branch known as the Mustaali (from whom the Dawoodi Bohra would eventually form), supported his other son, al-Musta'li. The Fatimid dynasty continued with al-Musta'li as both Imam and Caliph, and that joint position held until the 20th Imam, Al-Amir bi-Ahkami'l-Lah (1132 CE). At the death of 20th Imam Amir, one branch of the Mustaali faith claimed that he had transferred the Imamate to his son At-Tayyib Abu'l-Qasim, who was then two years old. Tayyeb's claim to the imamate was endorsed by the Hurrah al-Malika ("the Noble Queen") Arwa al-Sulayhi, the Queen of Yemen, who created the office of the Dai al-Mutlaq to administer the community in the Imam's absence. Zoeb bin Moosa (d.546 AH/1151 CE) was the first Dai-ul-Mutlaq, and lived and died in Haus, Yemen. Tayyibis (which include the Dawoodi Bohra) believe the second and current period of occultation (satr) began after Imam Tayyeb went into seclusion and Imam from his progeny is very much present as Mahdi on earth every time.
The Nizari Ismailis maintain that the Shi'a Ismaili Imams and Ismaili Muslim thinkers have explained that al-Mahdi is not a single person but actually a function undertaken by some of the hereditary Shi'a Ismaili Imams from the progeny of Prophet Muhammad and Imam 'Ali ibn Abi Talib. Throughout history, only a certain number of Imams have had the practical means to undertake such a grand mission of establishing justice and equity and removing oppression and injustice from the world because most of the Ismaili Imams have been heavily persecuted. For example, the founder of the Fatimid Caliphate, Imam 'Abdullah al-Mahdi, and the Fatimid-Imam Caliphs each performed the function or mission of the Mahdi. The Mahdi is therefore a mission carried out by several Shi'a Ismaili Imams and not a specific individual. Today, the 49th hereditary Ismaili Imam, Shah Karim al-Husayni Aga Khan IV, is undertaking the "Mahdi-ist" mission - the functions of the Mahdi - through the work of his institutions in the Aga Khan Development Network.
In Ahmadiyya belief the terms "Messiah" and "Mahdi" are synonymous terms for one and the same person. Like the term Messiah which, among other meanings, in essence means being anointed by God or appointed by God the term "Mahdi" means guided by God, thus both imply a direct ordination or commissioning and a spiritual nurturing by God of a divinely chosen individual. According to Ahmadiyya thought the prophesied eschatological figures of Christianity and Islam, the Messiah and Mahdi, were in fact to be fulfilled in one person who was to represent all previous prophets. The prophecies concerning the Mahdi or the Second Coming of Jesus are seen by Ahmadis as metaphorical and subject to interpretation. It is argued that one was to be born and rise within the dispensation of Muhammad, who by virtue of his similarity and affinity with Jesus, and the similarity in nature, temperament and disposition of the people of Jesus' time and the people of the time of the promised one (the Mahdi) is called by the same name.
These prophecies according to Ahmadi Muslims have been fulfilled in the person of Mirza Ghulam Ahmad (1835-1908), the founder of the Ahmadiyya Movement, who claimed to be divinely appointed as the second coming of Jesus and the Mahdi in 1891 around the same point in time after Muhammad as Jesus had appeared after Moses (thirteen centuries). Contrary to mainstream Islam, the Ahmadis do not believe that Jesus is alive in heaven, but claim that he survived the crucifixion and migrated towards the east where he died a natural death and that Ghulam Ahmad was only the promised spiritual second coming and likeness of Jesus, the promised Messiah and Mahdi.
The Mahdavia sect, founded by Muhammad Jaunpuri commonly known as Nur Pak claimed to be the Mahdi in Mecca, in front of Kaaba (between rukn and maqam) in the Hijri year 901(10th Hijri), and is revered as such by Mahdavia. He was born in Jaunpur, traveled throughout India, Arabia and Khorasan, where he died at the town of Farah, Afghanistan at the age of 63. The Mahdavi regard Jaunpuri as the Imam Mahdi, the Caliph of Allah and the second most important figure after the Islamic prophet Muhammad.
The following individuals (or their adherents on their behalf) have claimed to be the Mahdi: