The Mahdi (Arabic: ٱلْمَهْدِيّ, romanized: al-Mahdī, lit. 'the Guided'), also Masih al-Mahdi (Arabic: المسيح المهدي, romanized: al-Masīḥ al-Mahdī, lit. 'the Guided Redeemer'), is a messianic figure in Islamic belief. He is comparable to the Christian idea of the return of Jesus and the Mashiach ben David in Judaism. He 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 and will appear shortly before Jesus.
The Mahdi is mentioned in several compilations of hadith, but absent from the Quran and the two most-revered Sunni hadith collections (Sahih al-Bukhari and Sahih Muslim). As such, he plays only a marginal role in Sunni Islam and some Sunni theologians have rejected the concept of the Mahdi altogether. However, the Mahdi plays a significant role among Twelver Shias, who believe that the Mahdi is Imam Muhammad al-Mahdi, the twelfth Imam, son of the eleventh Imam Hasan al-Askari (d. 874), who is said to be in occultation (ghayba) by divine will.