Hagia Sophia (lit. 'Holy Wisdom'; Ancient Greek: Ἁγία Σοφία, romanized: Hagía Sophía; Latin: Sancta Sapientia; Turkish: Ayasofya), officially the Hagia Sophia Grand Mosque (Turkish: Ayasofya-i Kebir Cami-i Şerifi), is a mosque and major cultural and historical site in Istanbul, Turkey. Originally a Greek Orthodox church, the site has changed between being a mosque and a museum since the fall of the Byzantine Empire.
Originally built by the eastern Roman emperor Justinian I as the Christian cathedral of Constantinople for the state church of the Roman Empire between 532 and 537, and designed by the Greek geometers Isidore of Miletus and Anthemius of Tralles, it was formally called the Church of the Holy Wisdom (Greek: Ναὸς τῆς Ἁγίας τοῦ Θεοῦ Σοφίας, romanized: Naòs tês Hagías toû Theoû Sophías) and was then the world's largest interior space and among the first to employ a fully pendentive dome. It is considered the epitome of Byzantine architecture and is said to have "changed the history of architecture". The present Justinianic building was the third church of the same name to occupy the site, as the prior one had been destroyed in the Nika riots. As the episcopal see of the ecumenical patriarch of Constantinople, it remained the world's largest cathedral for nearly a thousand years, until Seville Cathedral was completed in 1520. Beginning with subsequent Byzantine architecture, Hagia Sophia became the paradigmatic Orthodox church form, and its architectural style was emulated by Ottoman mosques a thousand years later. It has been described as "holding a unique position in the Christian world" and as an architectural and cultural icon of Byzantine and Eastern Orthodox civilization.The religious and spiritual centre of the Eastern Orthodox Church for nearly one thousand years, the church was dedicated to the Holy Wisdom. It was where the excommunication of Patriarch Michael I Cerularius was officially delivered by Humbert of Silva Candida, the envoy of Pope Leo IX in 1054, an act considered the start of the East–West Schism. In 1204, it was converted during the Fourth Crusade into a Catholic cathedral under the Latin Empire, before being returned to the Eastern Orthodox Church upon the restoration of the Byzantine Empire in 1261. The doge of Venice who led the Fourth Crusade and the 1204 Sack of Constantinople, Enrico Dandolo, was buried in the church.
After the Fall of Constantinople to the Ottoman Empire in 1453, it was converted to a mosque by Mehmed the Conqueror and became the principal mosque of Istanbul until the 1616 construction of the Sultan Ahmed Mosque. Upon its conversion, the bells, altar, iconostasis, ambo, and baptistery were removed, while iconography, such as the mosaic depictions of Jesus, Mary, Christian saints and angels were removed or plastered over. Islamic architectural additions included four minarets, a minbar and a mihrab. The Byzantine architecture of the Hagia Sophia served as inspiration for many other religious buildings including the Hagia Sophia in Thessaloniki, Panagia Ekatontapiliani, the Şehzade Mosque, the Süleymaniye Mosque, the Rüstem Pasha Mosque and the Kılıç Ali Pasha Complex. The patriarchate moved to the Church of the Holy Apostles, which became the city's cathedral.
The complex remained a mosque until 1931, when it was closed to the public for four years. It was re-opened in 1935 as a museum under the secular Republic of Turkey, and the building is Turkey's most visited tourist attraction as of 2019.
In July 2020, the Council of State annulled the 1934 decision to establish the museum, and the Hagia Sophia was reclassified as a mosque. The 1934 decree was ruled to be unlawful under both Ottoman and Turkish law as Hagia Sophia's waqf, endowed by Sultan Mehmed, had designated the site a mosque; proponents of the decision argued the Hagia Sophia was the personal property of the sultan. This redesignation drew condemnation from the Turkish opposition, UNESCO, the World Council of Churches, the International Association of Byzantine Studies, and many international leaders.