Hagia Sophia stands on the site of an earlier basilican church erected by Constantius II in 360, some 30 years after Byzantium had become the capital of the Roman Empire. This church was burned in 404 and rebuilt by Theodosius II in 415, only to be again destroyed by fire in 532. The present structure, which is entirely fireproof, was built in 532–37 by Emperor Justinian from designs of his imperial architects Anthemius of Tralles and Isidorus of Miletus. As a result of severe earthquakes, the dome collapsed in 558, but it was rebuilt by 563 on a somewhat higher curve.
With the Turkish conquest of Constantinople in 1453, Hagia Sophia became a mosque and was renamed Aya Sofya Camii. In subsequent years all the interior figure mosaics were obscured under coatings of plaster and painted ornament; most of the Christian symbols elsewhere were obliterated. The four slender minarets, which rise so strikingly at the outer corners of the structure, were added singly and at different times; the crescent supplanted the cross on the summit of the dome, and the altar and the pulpit were replaced by the customary Muslim furnishings.