The Jameh Mosque sits a few minutes' walk north of the Sheikh Safi shrine and is much older than the Safavid complex it stands beside. Excavations have shown that the site was a place of worship long before the present brick structure was built — possibly a Zoroastrian fire temple, later a Sasanian-era religious building, then converted to a mosque after the Arab conquest.
What you see today is largely Seljuk-era brickwork, austere and unornamented, with the remains of a tall cylindrical minaret. It is not the showpiece the Safavid shrine is, but it is a quieter, more ancient counterpoint — and the contrast between the two periods of Persian Islamic architecture is one of the most interesting things in the city.