The Hagia Sophia is actually the third of three churches that have been built since the first “Great Church” was inaugurated on February 15, 360 CE by Emperor Constantius II. The church was called this because it was larger than most of the contemporary churches in the city at the time, and acted in concert with the Hagia Eirene – “Holy Peace” – as the principal churches of the Byzantine Empire and was said to be one of the world’s most impressive monuments at the time.
However when the Constantinople patriarch John Chrysostom came into conflict with the Empress Aelia Eudoxia, subsequent riots occurred after he was exiled on June 20, 404, and lead to the first church largely being burned down. The second church was built by Emperor Theodosius and inaugurated on October 10, 415 but unfortunately burned to the ground just over a hundred years later when a fire started during the Nika Revolt. Several marble blocks from the second church were discovered in 1935 beneath the western courtyard by A.M. Schneider, but due to concerns that further excavation could harm the integrity of the Hagia Sophia, additional requests to work around the museum have been denied.
A few days after the destruction Emperor Justinian I on February 23, 532, pronounced the building of a basilica that would be larger and more magnificent than its predecessors, and the final church that would call this location home. Material for its construction was brought from all over the empire – such as columns from the Temple of Atremis at Ephesus, or even stone from the quarries in Egypt – with over ten thousand being employed in its construction, this expansive building was inaugurated five short years later on December 27, 537 and continued to sit as the seat of the Orthodox patriarch. Aside from being the principle setting for Byzantine imperial ceremonies and coronations, the basilica also offered asylum to any claiming such need.
The building has had to go through numerous reconstructions after repeat earthquakes have caused many of the domes – including the main – to collapse, not to mention being extensively damaged by fire, and renovated by numerous emperors and sultans over the centuries, it was also ransacked by the Latin Christians during the Fourth Crusade and the capture of Constantinople. During this occupation (1204 – 1261) reputed relics such as stone from the tomb of Jesus, his shroud, and the bones of several saints were sent to churches in the West, and for its duration the Hagia Sophia became a Roman Catholic cathedral.