The mosque, six kilometres east of Qom, has long been a sacred place, at least since 373 A.H., 17th of Ramadan (22 February 984 C.E.), when according to the mosque website, one Sheikh Hassan ibn Muthlih Jamkarani is reported to have met Muhammad al-Mahdi along with the prophet Al-Khidr. Jamkarani was instructed that the land they were on was "noble" and that the owner — Hasan bin Muslim — was to cease cultivating it and finance the building of a mosque on it from the earnings he had accumulated from farming the land.
In the late 20th century, the mosque's reputation spread, and many pilgrims, particularly young people, began to come to it. In the rear of the mosque there is a "well of requests" where it is believed the Twelfth Imam once "became miraculously unhidden for a brief shining moment of loving communion with his Creator." Pilgrims tie small strings in a knot around the grids covering the holy well, which they hope will be received by the Imam Mahdi. Every morning custodians cut off the strings from the previous day.