Abbasid caliphs knew from the hadiths by the Prophet (s) and the Imams (a) that the Twelfth Imam was al-Mahdi, and thus, they assigned some guards to monitor Imam al-Hasan al-'Askari (a) and his house. According to historians, al-Mu'tamid al-'Abbasi had ordered the midwives to drop by sadat's houses, especially the house of Imam al-Hasan al-'Askari (a), search inside the house, learn about his wife, and report him about it. The birth of Imam al-Zaman (a) was hidden from people. The secrecy of his birth and its reasons are mentioned in some hadiths. According to a hadith from Imam al-Sajjad (a), "our Qa'im bears some traditions of the prophets. A tradition from Abraham (a) is the secrecy of his birth and his isolation from the people". And according to a hadith from Imam al-Sadiq (a), "the birth of Sahib al-Amr is hidden from the people until he reappears. This is in order for him not to have to pledge allegiance to anyone".
Some Sunni scholars have reported the birth of Imam al-Hasan al-'Askari's (a) son, but they are silent about the son being the promised Mahdi.
Shi'as' Awareness of the Birth
After Imam al-Zaman's (a) birth, some Shi'as who were close and reliable companions of Imam al-Hasan al-'Askari (a) saw Imam al-Zaman (a).For example, according to a hadith, Muhammad b. 'Uthman al-'Amri and 40 other people were in Imam al-Hasan al-'Askari's (a) house. The Imam (a) showed his son to them and said: "this is your Imam after me and my successor among you. Obey him and do not dispute about your religion. Otherwise you will be disorganized and you will never see him again".