St. Sophia is one of the most impressive medieval buildings in Ohrid. It is a large church with compound foundations and a complex history. The church was the center of the Ohrid archiepiscopacy which once had jurisdiction over the regions of the Danube, Thessaloniki and Albania. Believed to have been built or rebuilt on the grounds of an early Christian basilica between the years 1035-1056, the church is one of the best representatives of Macedonian religious architecture. During the time when Macedonia was part of the Ottoman Empire, the church was turned into a mosque and the frescoes were covered with plaster, thus successfully preserving them for future generations.