Imāmah (Arabic: اٍمامة) means "leadership" and is a concept in Twelver theology. The Twelve Imams are the spiritual and political successors to Muhammad, the Prophet of Islam, in the Twelver branch of Shia Islam. According to Twelver theology, the successors to Muhammad are infallible human beings, who rule justly over the community and maintain and interpret sharia and undertake the esoteric interpretation of the Quran. The words and deeds of Muhammad and the Imams guide the community. For this, the Imams must be free from error and sin and chosen by divine decree—nass—through the Prophet.
Shi'a believe that divine wisdom—'Aql—is the source of the souls of the Prophets and Imams and gives them esoteric knowledge—hikmah—and that their suffering is a means by which their devotees may acquire divine grace. The Imam is not the recipient of divine revelation, but has a close relationship with God, who guides him, allowing the Imam in turn to guide others. The Imamat, or belief in the divine guide, is a fundamental belief in Shia Islam and is based on the concept that God would not leave humanity without access to divine guidance.
According to the Twelvers, an Imam of the Age is always the divinely appointed authority on all matters of faith and law. Ali was the first Imam in this line and in the view of Twelvers the rightful successor to Muhammad, followed by the male descendants of Muhammad through his daughter Fatimah. Each Imam was the son of the previous Imam, with the exception of Husayn ibn Ali, who was the brother of Hasan ibn Ali. The twelfth and final Imam is Muhammad al-Mahdi, who is believed by the Twelvers to be alive and in hiding.