The Masjed-e-Hakim was built by the doctor of Shah Abbas II (Muhamad Daoud Molagheb - otherwise known as Toghreb Khan) between 1656 and 1662 according to an inscription over the porch he built nearer the bazaar, but stands partially, at any rate, on the site of a much older mosque built under the Buyids by Sahib Ismail Ibn Abbad, during the tenth century. Local legend has it that the Sahib taught in the area which now constitutes the main sanctuary chamber of the Masjed-e-Jomeh, and whose lower half possibly rivals this in antiquity. The original mosque was built predominantly of plaster and little has survived, although the pleasant ivory tone of the emaining parts stems from the use of this material. This entrance to the mosque, which is found in a somewhat uninspiring alleyway to the north-east of the main bazaar, is known as the Portal of Jorjir and is probably the oldest religious building in Isfahan. It shows the development of a quite unique style of ornamentation under the Deylamid rulers.
The archnet is particularly attractive with magnificent stucco kufic set into the simple squinches. Freed of the increasing use of pendentives which was to characterise later developments of the semi-dome, this has a transparent elegancy that rivals that of the dome of the Sheikh Lotfallah Mosque, 600 years later.
The excellent state of the portal stems from the fact that it was covered with mud walls until the Department of Antiquities uncovered it in 1956.