In Constantinople, the dome of the Hagia Sophia collapses. Justinian I immediately orders that the dome be rebuilt.

Hagia Sophia (lit. 'the Holy Wisdom'; Turkish: Ayasofya; Koin Greek: , romanized: Aga Sopha; Latin: Sancta Sophia), officially the Hagia Sophia Grand Mosque (Turkish: Ayasofya-i Kebir Cami-i erifi) and formerly the Church of the Holy Wisdom (Greek: , romanized: Nas tis Ayas tou Theo Sofas), is a Late Antique place of worship in Istanbul, designed by the Greek geometers Isidore of Miletus and Anthemius of Tralles. Built in 537 as the patriarchal cathedral of the imperial capital of Constantinople, it was the largest Christian church of the eastern Roman Empire (the Byzantine Empire) and the Eastern Orthodox Church, except during the Latin Empire from 1204 to 1261, when it temporarily became a Roman Catholic cathedral. In 1453, after the Fall of Constantinople to the Ottoman Empire, it was converted into a mosque. In 1935, the Republic of Turkey established it as a museum. In 2020, it was reconverted into a mosque.

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, the church 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 EastWest 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 Sleymaniye Mosque, the Rstem Pasha Mosque and the Kl 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 was Turkey's most visited tourist attraction in 2015 and 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.

Constantinople (; Greek: Κωνσταντινούπολις Kōnstantinoupolis; Latin: Constantinopolis; Ottoman Turkish: قسطنطينيه‎, romanized: Ḳosṭanṭīnīye) was the capital of the Roman/Byzantine Empire (330–1204 and 1261–1453), the Latin Empire (1204–1261), and the Ottoman Empire (1453–1922). The capital then moved to Ankara following the Turkish War of Independence. Officially renamed Istanbul in 1930, the city is today the largest city and financial centre of the Republic of Turkey (1923–present). It remains the largest city in Europe.

In 324, the ancient city of Byzantium was renamed "New Rome" and declared the new capital of the Roman Empire by Emperor Constantine the Great, after whom it was renamed, and dedicated on 11 May 330. Constantinople is generally considered to be the center and the "cradle of Orthodox Christian civilization". From the mid-5th century to the early 13th century, Constantinople was the largest and wealthiest city in Europe. The city became famous for its architectural masterpieces, such as Hagia Sophia, the cathedral of the Eastern Orthodox Church, which served as the seat of the Ecumenical Patriarchate, the sacred Imperial Palace where the Emperors lived, the Galata Tower, the Hippodrome, the Golden Gate of the Land Walls, and opulent aristocratic palaces. The University of Constantinople was founded in the fifth century and contained artistic and literary treasures before it was sacked in 1204 and 1453, including its vast Imperial Library which contained the remnants of the Library of Alexandria and had 100,000 volumes. The city was the home of the Ecumenical Patriarch of Constantinople and guardian of Christendom's holiest relics such as the Crown of thorns and the True Cross.

Constantinople was famed for its massive and complex fortifications, which ranked among the most sophisticated defensive architecture of Antiquity. The Theodosian Walls consisted of a double wall lying about 2 kilometres (1.2 mi) to the west of the first wall and a moat with palisades in front. Constantinople's location between the Golden Horn and the Sea of Marmara reduced the land area that needed defensive walls. The city was built intentionally to rival Rome, and it was claimed that several elevations within its walls matched Rome's 'seven hills'. The impenetrable defenses enclosed magnificent palaces, domes, and towers, the result of prosperity Constantinople achieved as the gateway between two continents (Europe and Asia) and two seas (the Mediterranean and the Black Sea). Although besieged on numerous occasions by various armies, the defenses of Constantinople proved impenetrable for nearly nine hundred years.

In 1204, however, the armies of the Fourth Crusade took and devastated the city and, for several decades, its inhabitants resided under Latin occupation in a dwindling and depopulated city. In 1261 the Byzantine Emperor Michael VIII Palaiologos liberated the city, and after the restoration under the Palaiologos dynasty, enjoyed a partial recovery. With the advent of the Ottoman Empire in 1299, the Byzantine Empire began to lose territories and the city began to lose population. By the early 15th century, the Byzantine Empire was reduced to just Constantinople and its environs, along with Morea in Greece, making it an enclave inside the Ottoman Empire; after a 53-day siege the city eventually fell to the Ottomans, led by Sultan Mehmed II, on 29 May 1453, whereafter it replaced Edirne (Adrianople) as the new capital of the Ottoman Empire.