Ahmadinejad is just reciting standard hadith boilerplate about the Mahdi. Ahmadineja even claims to be able to send the Shi'ite Mahdi messages by dropping notes down a sacred well.
Iran's Gov't Seeks Agreement with 12th Imam - in hiding since 13th century?
ping