Byzantine period According to later legend, during the reign of
Justin I, his nephew
Justinian had been accused of plotting against the throne. He was sentenced to death, avoided after Saints Sergius and Bacchus appeared before Justin and vouched for Justinian's innocence. He was freed and restored to his title of
Caesar, and in gratitude, he vowed to dedicate a church to the saints once he became emperor. The construction of this Church of Saints Sergius and Bacchus, between 527 and 536 AD, was one of the first acts of the reign of Justinian I, possibly begun under his predecessor Justin. The new church lay at the border between the First and Third
Regio of the City, in an irregular area between the Palace of
Hormisdas (the house of Justinian before he acceded to the throne) and the Church of the
Saints Peter and
Paul. Back then, the two churches shared the same
narthex,
atrium and
propylaea. The new church became the centre of the complex, and part still survives today, towards the south of the northern wall of one of the two other edifices. The church was one of the most important religious structures in Constantinople. Shortly after the church's building a
monastery bearing the same name was built near the edifice. Construction of the new church began either several years before or during that of
Hagia Sophia, built from 532 to 537. It was believed that the building had been designed by the same architects,
Isidorus of
Miletus and
Anthemius of
Tralles, as a kind of "dress rehearsal" for that of the largest church of the Byzantine Empire. However, the building is quite different in architectural detail from the Hagia Sophia and the notion that it was but a small-scale version has largely been discredited. During the years 536 and 537, the Palace of Hormisdas became a
Monophysite monastery, where followers of that sect, coming from the eastern regions of the Empire and escaping the persecutions against them, found protection by
Empress Theodora. In year 551
Pope Vigilius, who some years before had been summoned to Constantinople by Justinian, found refuge in the church from the soldiers of the Emperor who wanted to capture him, and this attempt caused riots. In 1740 the
Grand Vizier Hacı Ahmet Paşa restored the mosque and built the
Şadırvan (fountain). Damage caused by the earthquakes of 1648 and 1763 was repaired in 1831 under the reign of Sultan
Mahmud II. In 1762 the
minaret was first built. It was demolished in 1940 and built again in 1956. The pace of decay of the building, which already suffered because of humidity and earthquakes through the centuries, accelerated after the construction of the railway. Parts of SS. Peter and Paul to the south of the building were demolished to accommodate the rail line. Other damage was caused by the building's use as housing for the refugees during the
Balkan Wars. Due to the increasing threats to the building's static integrity, it was added some years ago to the
UNESCO watch list of endangered monuments. The
World Monuments Fund added it to its Watch List of the 100 Most Endangered Sites in 2002, 2004, and 2006. After an extensive restoration which lasted several years and ended in September 2006, it has been opened again to the public and for worship. == Architecture ==