A church with an octagonal dome, built in the 12th century (1149-1150). Carvings date from the 12th century and frescoes from the end of the 12th and the early 13th centuries.
Oral and written reports link the church to the Byzantine Emperor Andronicos II Palaiologos (1282-1328).
According to historical sources, it was dedicated to the Virgin Hodegitria.
After the Greek war of independence in 1821 it was rededicated to Aghia Sofia as it was believed to be a faithful replica of Aghia Sofia in Constantinople, the former Byzantine capital.
During the first Turkish occupation it was used as a mosque with the addition of of a mihrab and minaret on the south side.During the second Venetian occupation it served as the cathedral of a monastery of the Western doctrine dedicated to Madonna del Carmine, with the addition of a two-storey exo-narthex.In the second Turkish occupation it was again used as a mosque until the town was liberated in 1821, when it once again became a Christian place of worship.
The western side was restored in 1827 and in1846; the entire church underwent considerable restoration by Evstathios Stikas in 1958-59.