Hagia Sophia, the cathedral was built at Constantinople (now Istanbul) in the 6th century under the direction of the Byzantine emperor Justinian I.
The original church to occupy the site was commissioned by Emperor Constantine I in 325, razed during a riot in 404, later rebuilt, and destroyed once again in 532 before Justinian commissioned the building that exists today. Since then, mosaics were added throughout the Byzantine period, structural modifications were made in both the Byzantine and Ottoman periods, and features important to the Islamic architectural tradition were constructed during Ottoman ownership of the structure.
The structure originally erected on the site of the Hagia Sophia was a Christian cathedral called the Megale Ekklesia, which was commissioned by the first Christian Roman emperor, Constantine I. Prior to that, the site had been home to a pagan temple. It went through another religious conversion after the conquest of Constantinople by Ottoman Sultan Mehmed II in 1453, when it was designated a mosque. It would remain so for many centuries, until being secularized in 1934 by the Turkish Republic's first president. It was converted into a museum a year later, a decision which remains controversial.
Sultan Mehmed II designated the previously Christian church a mosque shortly after he conquered the city in 1453. Bringing the structure in line with the Islamic tradition called for a series of other modifications, not all of which were undertaken during the reign of Mehmed II. During Mehmed's rule, a wooden minaret (no longer standing), a mihrab (niche positioned in the direction of Mecca), a minbar (pulpit), a madrasah (school), and a grand chandelier were added. Later modifications included the construction of more minarets, the whitewashing of Christian mosaics, and the addition of structural supports.
The Hagia Sophia is part of the UNESCO World Heritage site in Istanbul. For almost a millennium after its construction, it was the largest cathedral in all of Christendom. It served as a center of religious, political, and artistic life for the Byzantine world and has provided us with many useful scholarly insights into the period. It was also an important site of Muslim worship after Sultan Mehmed II conquered Constantinople in 1453 and designated the structure a mosque. It would remain a mosque until being converted into a museum in the 1930s.