The church of Saint Sophia, built in the late 12th century in Upper Town of Monemvasia, is the most significant monument of the Castle. It is an octagonal church with imposing interior and magnificent wall paintings from the 12th and 13th century. Due to the numerous transformations of the church the majority of the frescos have not been saved. The church lived through all the historical periods of the town. It was therefore transformed, in a mosque and later into a main church (katholikon) of a western doctrine monastery, where a minaret and a two floor narthex were added. During the second Turkish rule, the church was used again as a Muslim temple and the frescos were covered with plaster. Local tradition relates the church with the emperor Andronikos Palaiologos II, while written sources attest that it was dedicated to Our Lady Hodegetria, in Mystras. It is considered to be a replica of Saint Sophia in Constantinople, and for that reason it was dedicated to the Holy Wisdom of God following the Greek revolution in 1821. Visitors can visit the monument in Upper Town of the citadel only on foot.