Aya Sofya also known as Hagia Sophia (Greek: Ἁγία Σοφία, "Holy Wisdom") is a Byzantine-era church building in Nicaea (now Iznik) in Turkey.
The church of Hagia Sophia was built by Justinian I in the middle of the city in the 6th century. It was modelled after the larger Hagia Sophia in Constantinople, and it was in this building that the Second Council of Nicaea met in 787 to end the first period of Byzantine Iconoclasm.
It was converted to a mosque after the fall of the city to the Ottoman Turks in 1337, and functioned as such until it was converted into a museum in 1935. Since November 2011, it again functions as a mosque.
Coordinates: 40°25′46″N 29°43′13″E / 40.42944°N 29.72028°E / 40.42944; 29.72028