If St.George is the oldest church then St.Sofia is the oldest Eastern Orthodox church in Sofia. Many legends surrounds its history, but it was actually built during the reign of the Byzantine Emperor Justinian between 527-565. In the 14th century the church gave its name to the city. During the Turkish rule minarets were added and the church functioned as a mosque until two earthquakes in the 19th century destroyed one of the minarets and the mosque was abandoned. Restoration work was begun after 1900. The present building is a cross basilica with three altars.