Central to the beliefs of Twelver Shia is the story of the hidden imam, Muhammad al-Mahdi, or simply the “mahdi,” meaning “divinely guided one.” In 874 A.D., the six-year-old son of the eleventh imam went into hiding to protect himself from the persecution of the reigning Abbasid empire. The Shia believe that he hid himself in a cave below a mosque in Samarra; this cave is blocked by a gate that the Shia call “Bab-al Ghayba,” or the “Gate of Occultation.” This is one of the most sacred sites in Shi’a Islam, and the faithful gather here to pray for the return of the twelfth imam. The occultation of the mahdi, known as “ghaybah” in Arabic, will end with his return to the world for the Last Judgment. This period will be marked by violent upheavals and attacks upon the faithful, but in the end, the mahdi with deliver the world to peace.
This prophecy marked a significant turn in the development of Shiism. In contrast to the more worldly Sunni tradition, which was gradually becoming accepted by the majority of Muslims, Shiism became more occult and mystical. As explained by religioius historian Karen Armstrong in her book ISLAM: A SHORT HISTORY,
The myth of the Occultation of the Hidden Imam was not intended to be taken literally, as a statement of mundane fact. It was a mystical doctrine, which expressed our sense of the divine as elusive, absent or just out of reach, present in the world, but not of it. It also symbolized the impossibility of implementing a truly religious policy in this world, since the caliphs had destroyed Ali’s line and driven “ilm” [knowledge of Islam] from the earth. Henceforth the Shii “ulama” [learned ones] became the representatives of the Hidden Imam, and used their mystical and rational insights to apprehend his will.
The prophecy is also ripe for political interpretation, and there have been several figures throughout history who have claimed to be the returned mahdi. In the era of the Caliphate, the Abbasid ruler Caliph al-Mahdi (775-85) chose his title in an attempt to gain support from the disaffected Shia. More recently, Muqtada al-Sadr named his Iraqi insurgent force The Mahdi Army, in reference to the Shia messiah.