Imam Mahdi,12th and last Imam of Twelver Shia Islam was born in 869 (15 Sha'ban 255 AH) in Samarra, Iraq. He has the same name as the holy prophet of Islam Muhammad. He is also known as Hujjat, Qaem, and Sahib-al-zaman (Master of the era). His respected father is Imam Hasan Askari, 11th imam of Shia and his beloved mother is Narjis.
The tyrant Abbasid rulers were aware that the son of Imam Hasan Askari by the name of Mahdi will appear to remove all kinds of corruption and tyranny; hence they planned to eliminate the child when he is born. Due to this the birth of Imam Mahdi was kept a secret like that of Abraham. So except for the most trusted of the Shias and his own family, no one knew of the existence of Imam Mahdi. In spite of this whenever there was an opportunity, Imam Hasan Askari showed his son to his trustworthy followers; that in future they may follow him. This was in order that the Shias may remain firm upon the right path, and not be led astray.
The early years of his life were spent in the usual way. When he was in his fifth year, he lost his respected father.
After this tragic event the responsibility of guiding the Shias was transferred upon him. At this time, He possessed all the qualities and the divine knowledge that was bestowed upon the previous Imams, by the Almighty, in the same way as Prophet Yahya in his childhood and Jesus in his infancy was favored with the divine office of Prophethood by Allah.
To be in security, Imam Mahdi were absent of people sight in two periods.
The first one which was shorter started from his birth (869 / 255 AH) or from martyrdom of his father (874 / 260 AH) and ended in about 941 (329 AH).
And the second and longer one started by the end of first period and has continued till now.
Imam Ja’far Sadiq (The 6th Imam) said:
"There are two occultations for Qaem. One is short and the other prolonged. In the short occultation only the special Shias will know of his whereabouts. And in the longer occultation only his trustworthy servants will know where he is."
During the period of short occultation Imam Mahdi himself appointed his deputies from among the righteous Shias. Four of them succeeded each other and continued to fulfill the duty of intermediaries. These four personalities conveyed the questions and problems to Imam and brought back the Imam's answers for the people.
And during the period of long occultation, when it is not possible to establish communication with Imam Mahdi at will, the people have been ordered to follow the true teachings of the Quran and Ahlul Bayt through the pious and religious scholars and the just jurists. The people must follow them to know what obligations they are supposed to fulfill.