The Mahdi (Arabic: ?, ISO 233: al-mahd?, meaning "the guided one") is an eschatological redeemer of Islam who, according to some Islamic traditions, will appear and rule for five, seven, nine, or nineteen years (according to differing interpretations) before the Day of Judgment (yawm al-qiyamah, meaning "the Day of Resurrection") and rid the world of evil.
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 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; and Riaz Ahmed Gohar Shahi.
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 Imam and is the awaited Mahdi. Tayyibi Isma'ili Shi'ites, including the Dawoodi Bohrah, believe that At-Tayyib Abu'l-Qasim is the current occulted Imam and Mahdi.
The term Mahdi does not occur in the Quran. It is derived from the Arabic root h-d-y (Arabic: ), 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-Hussain, and various Umayyad rulers (hud?t mahdiyy?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. 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 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 kingdom 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).
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: "The Mahdi is of my lineage. He will fill the earth with fairness and justice as it was filled with oppression and injustice, and he will rule for seven years.
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.
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.
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.
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.
According to some interpretations of the Quran, throughout the history of human life, the earth has never been without divine leaders and Allah has selected an appropriate man for every nation. There are two types of Quranic verses which have been interpreted as referring to the existence and advent of the Mahdi:
And the disbelievers say: "Why is not a sign sent down to him from his Lord?" You are only a warner, and to every people there is a guide.-- Quran (13:7).
-- Quran (21:105).
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:
According to Twelvers, 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, Muhammad 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 Antichrist and the Sufyani. The two armies will fight "one final apocalyptic battle" where the Mahdi and his forces will prevail over evil. After the Mahdi has ruled Earth for a number of years, Isa will return.
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 "hidden Imam" is Muhammad al-Mahdi, the Twelfth Imam. According to Shia Quran commentators,[which?] implicit references to the Mahdi can be found in the Quran.
Twelver Shi'ites (as the main branch of Shia, which consists of 85% of all Shia Muslims) claim that their twelfth Imam, Muhammad b. al-Hasan al-Askari, 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.
By Shi'ism, belief in the messianic Imam is not a part of their creed but it is the foundation of their creed. 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 Shias' perspective, Mahdi chose as a special deputy for a time 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 Simmari in 939 an order was issued by Mahdi stating that in six days Ali ibn Muhammad Simmari 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 Shia 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." 
Shias 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.
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.
Alí Mu?ammad Shírází (20 October 1819 - 9 July 1850), claimed to be the Mahdi on 24 May 1844, taking the name Báb (Arabic: / English: Gate) and thereby founding the religion of Bábism. He was later executed by firing squad in the town of Tabriz. His remains are buried in a tomb at the Bahá'í World Centre in Haifa, Israel.
The following individuals (or their adherents on their behalf) have claimed to be the Mahdi: