|Part of a series on|
The Mahdi (Arabic: ٱلْمَهْدِيّ, romanized: al-Mahdī, lit. 'the Guided') is a messianic figure in Islamic eschatology who is believed to appear at the end of times to rid the world of evil and injustice. He is said to be a descendant of Muhammad who will appear shortly before the prophet ʿĪsā (Jesus) and lead Muslims to rule the world.
Though the Mahdi is not referenced in the Quran, and is absent from several canonical compilations of hadith – including the two most-revered Sunni hadith collections: Sahih al-Bukhari and Sahih Muslim – he is mentioned in other hadith literature. The doctrine of the mahdi seems to have gained traction during the confusion and unrest of the religious and political upheavals of the first and second centuries of Islam. Among the first references to the Mahdi appear in the late 7th century, when the revolutionary Mukhtar ibn Abi Ubayd (c. 622–687) declared Muhammad ibn al-Hanafiyya, a son of caliph Ali (r. 656–661), to be the Mahdi. Although the concept of a Mahdi is not an essential doctrine in Islam, it is popular among Muslims. It has been a part of the ʿaqīdah (creed) of Muslims for 1,400 years. Over centuries, there have been a vast number of Mahdi claimants.
The Mahdi features in both Shi'a and Sunni branches of Islam, though they differ extensively on his attributes and status. Among Twelver Shi'as, the Mahdi is believed to be Muhammad al-Mahdi, son of the eleventh Imam, Hasan al-Askari (d. 874), who is said to have been in occultation (ghayba) by divine will. This is rejected by most Sunnis, who assert that the Mahdi has not been born yet.
The term Mahdi is derived from the Arabic root h-d-y (ه-د-ي), commonly used to mean "divine guidance". Although the root appears in the Qur'an at multiple places and in various contexts, the word Mahdi never occurs in the book. The associated verb is hada, which means to guide. However, Mahdi can be read in active voice, where it means the one who guides, as well as passive voice, where it means the one who is guided. In the doctrinal sense, Mahdi is the title of the end-times eschatological redeemer in most Islamic sects.
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 re-establish 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 earlier messianic Judeo-Christian beliefs. Accordingly, traditions were introduced to support certain political interests, especially anti-Abbasid sentiments. These traditions about the Mahdi appeared only at later times in ḥadīth collections such as Jami' at-Tirmidhi and Sunan Abu Dawud, but are absent from the early works of Bukhari and Muslim.
The term al-Mahdi was employed from the beginning of Islam, but only as an honorific epithet ("the guide") and without any messianic significance. As an honorific, it was used in some instances to describe Muhammad (by Hassan ibn Thabit), Abraham, al-Husayn, and various Umayyad caliphs (هداة مهديون, hudat mahdiyyun). During the Second Muslim Civil War (680–692), after the death of Mu'awiya I (r. 661–680), the term acquired a new meaning of a ruler who would restore Islam to its perfect form and restore justice after oppression. Abd Allah ibn al-Zubayr, who laid claim to the caliphate against the Umayyads and found temporary success during the civil war, presented himself in this role. Although the title Mahdi was not applied to him, his career as the anti-caliph significantly influenced the future development of the concept. A hadith was promulgated in which Muhammad prophesies the coming of a just ruler.[a]
There will arise a difference after the death of a caliph, and a man of the people of Medina will go forth fleeing to Mecca. Then some of the people of Mecca will come to him and will make him rise in revolt against his will ... An expedition will be sent against him from Syria but will be swallowed up ... in the desert between Mecca and Medina. When the people see this, the righteous men ... of Syria and ... Iraq will come to him and pledge allegiance to him. Thereafter a man of the Quraysh will arise whose maternal uncles are of Kalb. He will send an expedition against them, but they will defeat them ... He will then divide the wealth and act among them according to the Sunna of their Prophet. Islam will settle down firmly on the ground ... He will stay seven years and then die, and the Muslims will pray over him.
Refusing to recognize the new caliph, Yazid I (r. 680–683), after Mu'awiya's death in 680, Ibn al-Zubayr had fled to the Meccan sanctuary. From there he launched anti-Umayyad propaganda, calling for a shura of the Quraysh to elect a new caliph. Those opposed to the Umayyads were paying him homage and asking for the public proclamation of his caliphate, forcing Yazid to send an army to dislodge him in 683. After defeating rebels in the nearby Medina, the army besieged Mecca but was forced to withdraw as a result of Yazid's sudden death shortly afterward. Ibn al-Zubayr was recognized caliph in Arabia, Iraq, and parts of Syria, where Yazid's son and successor Mu'awiya II (r. 683–684) held power in Damascus and adjoining areas. The hadith hoped to enlist support against an expected Umayyad campaign from Syria. The Umayyads did indeed send another army to Mecca in 692, but contrary to the hadith's prediction was successful in removing Ibn al-Zubayr. The hadith lost relevance soon afterward, but resurfaced in the Basran hadith circles a generation later, this time removed from its original context and understood as referring to a future restorer.
Around the time when Ibn al-Zubayr was trying to expand his dominion, the pro-Alid revolutionary al-Mukhtar al-Thaqafi took control of the Iraqi garrison town of Kufa in the name of Ali's son Muhammad ibn al-Hanafiyya, whom he proclaimed as the Mahdi in the messianic sense. The association of the name Muhammad with the Mahdi seems to have originated with Ibn al-Hanafiyya, who also shared the epithet Abu al-Qasim with Muhammad, the Islamic prophet. Among the Umayyads, the caliph Sulayman ibn Abd al-Malik (r. 715–717) encouraged the belief that he was the Mahdi, and other Umayyad rulers, like Umar II (r. 717–720), have been addressed as such in the panegyrics of Jarir (d. 728) and al-Farazdaq (d. 728–730).
Early discussions about the identity of the 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 (hadith) 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 had been satisfied. In Medina, among the conservative religious circles, the belief in Umar II being the Mahdi was widespread. Said ibn al-Musayyib (d. 715) 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 (d. 728) opposed the concept of a Muslim Messiah but believed that if there was the Mahdi, it was Umar II.
By the time of the Abbasid Revolution in 750, Mahdi was already a known concept. Evidence shows that the first Abbasid caliph Saffah (r. 750–754) assumed the title of "the Mahdi" for himself.
In Shi'a Islam, the eschatological Mahdi was commonly given the epithet al-Qa'im (القائم), which can be translated as 'he who will rise,' signifying his rise against tyranny in the end of time. Distinctively Shi'a is the notion of temporary absence or occultation of the Mahdi, whose life has been prolonged by divine will. An intimately related Shi'a notion is that of raj'a (lit. 'return'), which often means the return to life of (some) Shi'a Imams, particularly Husayn ibn Ali, to exact their revenge on their oppressors.
Traditions that predicted the occultation and rise of a future imam were already in circulation for a century before the death of the eleventh Imam in 260 (874 CE), and possibly as early as the seventh-century CE. These traditions were appropriated by various Shi'a sects in different periods, including the now-extinct sects of Nawusites and Waqifites.  For instance, these traditions were cited by the now-extinct Kaysanites, who denied the death of Ibn al-Hanafiyya, and held that he was in hiding in the Razwa mountains near Medina. This likely originated with two groups of his supporters, namely, southern Arabian settlers and local recent converts in Iraq, who seem to have spread the notions now known as occultation and raj'a. Later on, these traditions were also employed by the Waqifites to argue that Musa al-Kazim, the seventh Imam, had not died but was in occultation.
In parallel, traditions predicting the occultation of a future imam also persisted in the writings of the mainstream Shi'a, who later formed the Twelvers. Based on this material, the Twelver doctrine of occultation crystallized in the first half of the fourth (tenth) century, in the works of Ibrahim al-Qummi (d. 919), Ya'qub al-Kulayni (d. 941), and Ibn Babawayh (d. 991), among others. This period also saw a transition in Twelver arguments from a traditionist to a rationalist approach in order to vindicate the occultation of the twelfth Imam. 
The Twelver authors also aim to establish that the description of Mahdi in Sunni sources applies to the twelfth Imam. Their efforts gained momentum in the seventh (thirteenth) century when some notable Sunni scholars endorsed the Shi'a view of the Mahdi, including the Shafi'i traditionist Muhammad ibn Yusuf al-Gandji. Since then, Amir-Moezzi writes, there is Sunni support from time to time for the Twelvers' view of Mahdi.  There has also been some support for the mahdiship of the twelfth Imam in Sufi circles, for instance, by the Egyptian Sufi al-Sha'rani.
Before the rise of the Fatimid Caliphate, as a major Isma'ili Shi'a dynasty, the terms Mahdi and Qa'im were used interchangeably for the messianic imam anticipated in Shi'a traditions. With the rise of the Fatimids in the tenth century CE, however, al-Qadi al-Nu'man argued that some of these predictions had materialized by the first Fatimid caliph, Abdallah al-Mahdi Billah, while the rest would be fulfilled by his successors. Henceforth, their literature referred to the awaited eschatological imam only as Qa'im (instead of Mahdi). In Zaydi view, imams are not endowed with superhuman qualities, and expectations for their mahdiship are thus often marginal. One exception is the now-extinct Husaynites in Yemen, who denied the death of al-Husayn ibn al-Qasim al-Iyani and awaited his return.
In Sunni Islam, the Mahdi doctrine is not theologically important and remains as a popular belief instead. Of the six canonical Sunni hadith compilations, only three—Abu Dawood, Ibn Maja, and Tirmidhi—contain traditions on the Mahdi; the compilations of Bukhari and Muslim—considered the most authoritative by the Sunnis and the earliest of the six—do not, nor does Nasai. Some Sunnis, including the philosopher and historian Ibn Khaldun (d. 1406), and reportedly also Hasan al-Basri (d. 728), an influential early theologian and exegete, deny the Mahdi being a separate figure, holding that Jesus will fulfill this role and judge over mankind; Mahdi is thus considered a title for Jesus when he returns. Others, like the historian and the Qur'an commentator Ibn Kathir (d. 1373), elaborated a whole apocalyptic scenario which includes prophecies about the Mahdi, Jesus, and the Dajjal (the antichrist) during the end times.
The common opinion among the Sunnis is that the Mahdi is an expected ruler to be sent by God before the end times to re-establish righteousness. He is held to be from among the descendants of Muhammad through his daughter Fatima and her husband Ali, and his physical characteristics including a broad forehead and curved nose. He will eradicate injustice and evil from the world. He will be from the Hasanid branch of Muhammad's descendants, as opposed to the Shi'a belief that he is of the Husaynid line. The Mahdi's name would be Muhammad and his father's name would be Abd Allah. Abu Dawood quotes Muhammad as saying: "The Mahdi will be from my family, from the descendants of Fatimah". Another hadith states:
Even if only one day remains [until the doomsday], God will lengthen this day until He calls forth a man from me, or from the family of my house, his name matching mine and his father's name matching that of my father. He will fill the Earth with equity and justice just as it had previously been filled with injustice and oppression.
Before the arrival of the Mahdi, the earth would be filled with anarchy and chaos. Divisions and civil wars, moral degradation, and worldliness would be prevalent among the Muslims. Injustice and oppression would be rampant in the world. In the aftermath of the death of a king, the people would quarrel among themselves, and the as yet unrecognized Mahdi would flee from Medina to Mecca to take refuge in the Ka'ba. Against his will, would the Mahdi be recognized as ruler by the people. The Dajjal would appear and will spread corruption in the world. With an army bearing black banners, which would come to his aid from the east, the Mahdi would confront the Dajjal, but would be unable to defeat him. Dressed in saffron robes with his head anointed, Jesus would descend at the point of a white minaret of the Umayyad Mosque in eastern Damascus and join the Mahdi. Jesus would pray behind the Mahdi and then kill the Dajjal. The Gog and Magog would also appear wreaking havoc before their final defeat by the forces of Jesus. Although not as significant as the Dajjal and the Gog and Magog, the Sufyani, another representative of the forces of dark, also features in the Sunni traditions. He will rise in Syria before the appearance of Mahdi. When the latter appears, the Sufyani, along with his army, will either be swallowed up en route to Mecca by the earth with God's command or defeated by the Mahdi. Jesus and the Mahdi will then conquer the world and establish caliphate. The Mahdi will die after 7 to 13 years, whereas Jesus after 40 years. Their deaths would be followed by reappearance of corruption before the final end of the world.
Main article: Muhammad al-Mahdi
In Twelver Shi'ism, the largest Shi'i branch, the belief in the messianic imam is not merely a part of creed, but the pivot. For the Twelver Shi'a, the Mahdi was born but disappeared, and would remain hidden from humanity until he reappears to bring justice to the world in the end of time, a doctrine known as the Occultation. This imam in occultation is the twelfth imam, Muhammad, son of the eleventh imam, Hasan al-Askari. According to the Twelvers, the Mahdi was born in Samarra around 868, though his birth was kept hidden from the public. He lived under his father's care until 874 when the latter was killed by the Abbasids.
When his father died in 874, possibly poisoned by the Abbasids, the Mahdi went into occultation by the divine command and was hidden from public view for his life was in danger from the Abbasids. Only a few of the elite among the Shi'a, known as the deputies (سفراء, sufara; sing. سفير safir) of the twelfth imam, were able to communicate with him; hence the occultation in this period is referred to as the Minor Occultation (ghayba al-sughra).
The first of the deputies is held to have been Uthman ibn Sa'id al-Amri, a trusted companion and confidant of the eleventh imam. Through him the Mahdi would answer the demands and questions of the Shi'a. He was later succeeded by his son Muhammad ibn Uthman al-Amri, who held the office for some fifty years and died in 917. His successor Husayn ibn Rawh al-Nawbakhti was in the office until his death in 938. The next deputy, Ali ibn Muhammad al-Simari, abolished the office on the orders of the imam just a few days before his death in 941.
With the death of the fourth agent, thus began the Major Occultation (الغيبة الكبرى, ghayba al-kubra), in which the communication between the Mahdi and the faithful was severed. The leadership vacuum in the Twelver community was gradually filled by jurists. During the Major Occultation, the Mahdi roams the earth and is sustained by God. He is the lord of the time (صاحب الزمان sahib az-zamān) and does not age. Although his whereabouts and the exact date of his return are unknown, the Mahdi is nevertheless believed to contact some of his Shi'a if he wishes. The accounts of these encounters are numerous and widespread in the Twelver community. Shi'a scholars have argued that the longevity of the Mahdi is not unreasonable given the long lives of Khidr, Jesus, and the Dajjal, as well as secular reports about long-lived men. Along these lines, Tabatabai emphasizes the miraculous qualities of al-Mahdi, adding that his long life, while unlikely, is not impossible. He is viewed as the sole legitimate ruler of the Muslim world and the constitution of the Islamic Republic of Iran recognizes him as the head of the state.
Before his reappearance (ظهور, zuhur), the world will plunge into chaos, where immorality and ignorance will be commonplace, the Qur'an will be forgotten, and religion will be abandoned. There will be plagues, earthquakes, floods, wars and death. The Sufyani will rise and lead people astray. The Mahdi will then reappear in Mecca, with the sword of Ali (dhu'l-fiqar) in his hand, between the corner of the Ka'ba and the station of Abraham.
By some accounts, he will reappear on the day of ashura (tenth of Muharram), the day the third Shi'a imam Husayn ibn Ali was slain. He will be "a young man of medium stature with a handsome face," with black hair and beard. A divine cry will call the people of the world to his aid, after which the angels, jinns, and humans will flock to the Mahdi. This is often followed shortly by another supernatural cry from the earth that invites men to join the enemies of the Mahdi, and would appeal to disbelievers and hypocrites.
The Mahdi will then go to Kufa, which will become his capital, and send troops to kill the Sufyani in Damascus. Husayn and his slain partisans are expected to resurrect to avenge their deaths, known as the doctrine of raj'a (lit. 'return'). The episode of Jesus' return in the Twelver doctrine is similar to the Sunni belief, although in some Twelver traditions it is the Mahdi who would kill the Dajjal. Those who hold enmity towards Ali ibn Abi Talib (ناصبيّ, nasibis) will be subject to jizya (poll tax) or killed if they do not accept Shi'ism.
The Mahdi is also viewed as the restorer of true Islam, and the restorer of other monotheistic religions after their distortion and abandonment. He establishes the kingdom of God on earth and Islamizes the whole world. In their true form, it is believed, all monotheistic religions are essentially identical to Islam as "submission to God." It is in this sense, according to Amir-Moezzi, that one should understand the claims that al-Mahdi will impose Islam on everyone. His rule will be paradise on earth, which will last for seventy years until his death, though other traditions state 7, 19, or 309 years.
In Isma'ilism a distinct concept of the Mahdi developed, with select Isma'ili imams representing the Mahdi or al-Qa'im at various times. When the sixth Shi'a imam Ja'far al-Sadiq died, some of his followers held his already dead son Isma'il ibn Ja'far to be the imam asserting that he was alive and will return as the Mahdi. Another group accepted his death and acknowledged his son Muhammad ibn Isma'il as the imam instead. When he died, his followers too denied his death and believed that he was the last imam and the Mahdi. By the mid-9th century, Isma'ili groups of different persuasions had coalesced into a unified movement centered in Salamiyya in central Syria, and a network of activists was working to collect funds and amass weapons for the return of the Mahdi Muhammad ibn Isma'il, who would overthrow the Abbasids and establish his righteous caliphate.[b] The propaganda of the Mahdi's return had a special appeal to peasants, Bedouins, and many of the later-to-be Twelver Shi'is, who were in a state of confusion (hayra) in the aftermath of the death of their 11th imam Hasan al-Askari, and resulted in many conversions.
In 899, the leader of the movement, Abd Allah ibn al-Husayn, declared himself the Mahdi. This brought about schism in the unified Isma'ili community as not all adherents of the movement accepted his Mahdist claims. Those in Iraq and Arabia, known as Qarmatians after their leader Hamdan Qarmat, still held that Muhammad ibn Isma'il was the awaited Mahdi and denounced the Salamiyya-based Mahdism. In the Qarmati doctrine, the Mahdi was to abrogate the Islamic law (the Sharia) and bring forth a new message. In 931, the then Qarmati leader Abu Tahir al-Jannabi declared a Persian prisoner named Abu'l-Fadl al-Isfahani as the awaited Mahdi. The Mahdi went on to denounce Moses, Jesus, and Muhammad as liars, abolished Islam, and instituted the cult of fire. Abu Tahir had to depose him as imposter and had him executed. Meanwhile, in Syria, Abd Allah al-Mahdi's partisans took control of the central Syria in 903 before they were routed by the Abbasids. He now went to North Africa and founded the Fatimid Caliphate in Qayrawan in 909. Messianic expectations associated with the Mahdi nevertheless did not materialize, contrary to the expectations of his propagandists and followers who expected him to do wonders. He attempted to downplay messianism and asserted that the propaganda of Muhammad ibn Isma'il's return as the Mahdi had only been a ruse to avoid Abbasid persecution and protect the real imam predecessors of his. The Mahdi was actually a collective title of the true imams from the progeny of Ja'far al-Sadiq. He later branded as the Mahdi his son, who had the name as was expected of the Mahdi—Muhammad ibn Abd Allah. The Fatimids eventually dropped the millenarian rhetoric.
In Zaydism, the concept of imamate is different from the Isma'ili and Twelver branches; a Zaydi Imam is any respectable person from the descendants of Ali and Fatima who lays claim to political leadership and struggles for its acquisition. As such, the Zaydi imamate doctrine lacks eschatological characteristics and there is no end-times redeemer in Zaydism. The title of mahdi has been applied to several Zaydi imams as an honorific over the centuries.[c]
Further information: Mirza Ghulam Ahmad
In the Ahmadiyya belief, the prophesied eschatological figures of Christianity and Islam, the Messiah and Mahdi, actually refer to the same person. These prophecies were fulfilled in Mirza Ghulam Ahmad (1835–1908), the founder of the movement; he is held to be the Mahdi and the manifestation of Jesus. However, the historical Jesus in their view, although escaped crucifixion, nevertheless died and will not be coming back. Instead, God made Mirza Ghulam Ahmad the exact alike of Jesus in character and qualities. Similarly, the Mahdi is not an apocalyptic figure to launch global jihad and conquer the world, but a peaceful mujaddid (renewer of religion), who spreads Islam with "heavenly signs and arguments".
Main article: List of Mahdi claimants
Throughout history, various individuals have claimed to be or were proclaimed to be the Mahdi. Claimants have included Muhammad Jaunpuri, the founder of the Mahdavia sect; Ali Muhammad Shirazi, the founder of Bábism; Muhammad Ahmad, who established the Mahdist State in Sudan in the late 19th century. The Iranian dissident Massoud Rajavi, the leader of the MEK, also claimed to be a 'representative' of the Mahdi. The adherents of the Nation of Islam hold Wallace Fard Muhammad, the founder of the movement, to be the Messiah and the Mahdi. Adnan Oktar, a Turkish cult leader, is considered by his followers as the Mahdi.
Ibn Khaldun noted a pattern where embracing a Mahdi claimant enabled unity among tribes and/or a region, often enabled them to forcibly seize power, but the lifespan of such a force was usually limited, as their Mahdi had to conform to hadith prophesies – winning their battles and bringing peace and justice to the world before Judgement Day – which (so far) none have.
((cite book)): CS1 maint: ignored ISBN errors (link)