The third sacred building on the site to bear the name, the existing Haghia Sophia ('Divine Wisdom') was dedicated on 26 December AD 537 by Emperor Justinian. He had come to power less than a century after the fall of Rome, and was eager to prove his capital a worthy successor to imperial glory. Approached by a grand colonnaded avenue beginning at the city gates, Justinian's cathedral towered over all else and was topped by the largest dome ever constructed - a record it held until the Romans reclaimed their pride just over a thousand years later with Michelangelo's dome for St Peter's (1590). In the meantime, Justinian's dome took on almost fabled status. It was of such thin material, wrote the chroniclers of old, that the hundreds of candles hung high within would cause it to glow at night like a great golden beacon, which was visible to ships far out on the Sea of Marmara.
Adding to the wonder, the church served as a vast reliquary, housing a pilgrim's delight of biblical treasures, including fragments of the True Cross, the Virgin's veils, the lance that pierced Jesus's side, St Thomas's doubting finger, and a large assortment of other saintly limbs, skulls and clippings.
All this was lost in 1204, when adventurers and freebooters on Western Christendom's Fourth Crusade, raised to liberate Jerusalem and the Holy Lands, decided they would be equally content with a treasure-grabbing raid on the luxurious capital of their Eastern brethren. At Haghia Sophia they ripped the place apart, carrying off everything they could, and added insult to thievery by infamously placing a prostitute on the imperial throne.
Further destruction was narrowly avoided in 1453, when the Ottoman Turk armies, led by Mehmet II, breached the walls of the city of Constantinople and put its Byzantine defenders to flight. Those who took refuge in the church were slaughtered, but the conquering sultan allegedly rounded on a looting soldier whom he found hacking at the marble floors, telling him: 'The gold is thine, the building mine.'
Haghia Sophia may have been spared, but it was a loss to Christianity. The Friday after the conquest, the church resounded to the chant, 'There is no god but Allah, and Mohammed is his Prophet'. The church had been converted into a mosque. During its time as a mosque the basilica acquired the addition of four minarets, from which to deliver the Muslim call to prayer. The construction of these minarets was staggered; only two are matching. In 1317, a series of unsightly buttresses was deemed necessary when the church seemed to be in danger of collapse. These aside, what you see today is essentially the church exactly as it was in Justinian's time.
At the death of the Ottoman Empire, with plans afoot to partition Istanbul along national lines, both the Greeks (on behalf of the Eastern Church) and the Italians (on behalf of the Western Church) lobbied for Haghia Sophia to be handed over to them. In Britain, a Saint Sophia Redemption Committee was formed. The Ottoman government posted soldiers with machine guns in the mosque to thwart any attempt at a Christian coup. An expedient solution was effected by the leaders of the new Turkish republic in 1934, who deconsecrated the building and declared it a museum. This action remains controversial, with Islamists periodically calling for it to be restored as a mosque. Comparing the pristine state of the neighbouring mosques with the shabby state of Haghia Sophia, you can't help wondering if they have a point.
At least the cathedral's interior remains impressive, particularly the main chamber with its fabulous dome, 30m (98ft) in diameter. The other extraordinary interior features are the mosaics. Plastered over by the conquering Ottomans, they were only rediscovered during renovations in the mid 19th century. Some of the best decorate the outer and inner narthexes, which are the long, vaulted chambers inside the present main entrance. The non-figurative geometrical and floral designs are the earliest and date from the reign of Justinian. Further mosaics adorn the galleries, reached by a stone ramp at the northern end of the inner narthex.
At the eastern end of the south gallery, just to the right of the apse, is a glimmering representation of Christ flanked by the famous 11th-century empress, Zoe, and her third husband, Constantine IX. One of the few women to rule Byzantium, Zoe married late and was a virgin until the age of 50. She must have developed a taste for what she discovered, proceeding to go through a succession of husbands and lovers in the years left to her.
On the mosaic in question, the heads and inscriptions show signs of being altered, possibly in an attempt to keep up with her active love life. En route to see Zoe is a slab marking the burial place of Enrico Dandalo, doge of Venice, a leader of the Fourth Crusade, and the man held responsible for persuading the Latins to attack Constantinople. Following the Ottoman conquest of the city, it is said that his tomb was smashed open and his bones thrown to the dogs.