Famous in particular for its massive dome, it is considered the epitome of Byzantine architecture and is said to have "changed the history of architecture". It remained the world's largest cathedral for nearly a thousand years, until Seville Cathedral was completed in 1520.
The current building was originally constructed as a church between 532 and 537 on the orders of the Byzantine Emperor Justinian I and was the third Church of the Holy Wisdom to occupy the site, the previous two having both been destroyed by rioters. It was designed by the Greek geometers Isidore of Miletus and Anthemius of Tralles.
The church was dedicated to the Wisdom of God, the Logos, the second person of the Holy Trinity, its patronal feast taking place on 25 December, the commemoration of the birth of the incarnation of the Logos in Christ. Although sometimes referred to as Sancta Sophia (as though it were named after Saint Sophia), sophia being the phonetic spelling in Latin of the Greek word for wisdom, its full name in Greek is Ναὸς τῆς Ἁγίας τοῦ Θεοῦ Σοφίας, Naos tēs Hagias tou Theou Sophias, "Shrine of the Holy Wisdom of God".
The church contained a large collection of holy relics and featured, among other things, a 15-metre (49 ft) silver iconostasis. The focal point of the Eastern Orthodox Church for nearly one thousand years, the building witnessed the excommunication of Patriarch Michael I Cerularius on the part of Humbert of Silva Candida, the papal envoy of Pope Leo IX in 1054, an act which is commonly considered the start of the Great Schism.
In 1453, Constantinople was conquered by the Ottoman Turks under Sultan Mehmed II, who ordered this main church of Orthodox Christianity converted into a mosque. By that point, the church had fallen into a state of disrepair. Nevertheless, the Christian cathedral made a strong impression on the new Ottoman rulers and they decided to convert it into a mosque. The bells, altar, iconostasis, and sacrificial vessels and other relics were removed and the mosaics depicting Jesus, his Mother Mary, Christian saints and angels were also removed or plastered over. Islamic features—such as the mihrab, minbar, and four minarets—were added. It remained a mosque until 1931, when it was closed to the public for four years. It was re-opened in 1935 as a museum by the Republic of Turkey. Hagia Sophia was, as of 2014, the second-most visited museum in Turkey, attracting almost 3.3 million visitors annually. According to data released by the Turkish Culture and Tourism Ministry, Hagia Sophia was Turkey’s most visited tourist attraction in 2015.
From its initial conversion until the construction of the nearby Sultan Ahmed Mosque (Blue Mosque of Istanbul) in 1616, it was the principal mosque of Istanbul. The Byzantine architecture of the Hagia Sophia served as inspiration for many other Ottoman mosques, such as the Blue Mosque, the Şehzade Mosque, the Süleymaniye Mosque, the Rüstem Pasha Mosque and the Kılıç Ali Paşa Mosque