Hagia Sophia

Hagia Sophia (; from ; ; ), officially Ayasofya-i Kebir Cami-i Şerifi, literally Holy Mosque of Hagia Sophia the Grand, and formerly the Church of Hagia Sophia, is a Late Antique place of worship in Istanbul, designed by the Greek geometers Isidore of Miletus and Anthemius of Tralles. Built in 537 as the patriarchal cathedral of the imperial capital of Constantinople, it was the largest Christian church of the eastern Roman Empire (the Byzantine Empire) and the Eastern Orthodox Church, except during the Latin Empire from 1204 to 1261, when it became the city's Latin Catholic cathedral. In 1453, after the Fall of Constantinople to the Ottoman Empire, it was converted into a mosque. In 1935 the secular Turkish Republic established it as a museum. In 2020, it re-opened as a mosque. 
Built by the eastern Roman emperor Justinian I as the Christian cathedral of Constantinople for the state church of the Roman Empire between 532 and 537, the church was then the world's largest interior space and among the first to employ a fully pendentive dome. It is considered the epitome of Byzantine architecture and is said to have "changed the history of architecture". The present Justinianic building was the third church of the same name to occupy the site, the prior one having been destroyed in the Nika riots. Being the episcopal see of the ecumenical patriarch of Constantinople, it remained the world's largest cathedral for nearly a thousand years, until Seville Cathedral was completed in 1520. Beginning with subsequent Byzantine architecture, Hagia Sophia became the paradigmatic Orthodox church form and its architectural style was emulated by Ottoman mosques a thousand years later. It has been described as "holding a unique position in the Christian world", and architectural and cultural icon of Byzantine and Eastern Orthodox civilization. 
The church was dedicated to the Holy Wisdom, the Logos, the second person of the Trinity. Its patronal feast falls on 25 December (Christmas), the commemoration of the incarnation of the Logos in Christ. "Sophia" is the Latin transliteration of the Greek word for wisdom and, although sometimes referred to as , it is not connected with Sophia the Martyr. The centre of the Eastern Orthodox Church for nearly one thousand years, the building witnessed the excommunication of Patriarch Michael I Cerularius officially delivered by Humbert of Silva Candida, the papal envoy of Pope Leo IX in 1054, an act that is commonly considered the start of the East–West Schism. In 1204, it was converted by the Fourth Crusaders to a Latin Catholic cathedral under the Latin Empire, before being restored to the Eastern Orthodox Church upon the return of the Byzantine Empire in 1261. The doge of Venice who led the Fourth Crusade and the 1204 Sack of Constantinople, Enrico Dandolo, was buried in the church.
After the Fall of Constantinople to the Ottoman Empire in 1453, it was converted to a mosque by Mehmed the Conqueror. The patriarchate moved to the Church of the Holy Apostles, which became the city's cathedral. Although some parts of the city had fallen into disrepair, the cathedral had been maintained with funds set aside for this purpose, and the Christian cathedral made a strong impression on the new Ottoman rulers who conceived its conversion.<ref name="http://www.livescience.com/27574-hagia-sophia.html2"></ref> The bells, altar, iconostasis, ambo and baptistery were removed and relics destroyed. The mosaics depicting Jesus, his mother Mary, Christian saints, and angels were eventually destroyed or plastered over. Islamic architectural features were added, such as a minbar (pulpit), four minarets, and a mihrab – a niche indicating the direction of prayer (qibla). From its initial conversion until the construction in 1616 of the nearby Sultan Ahmed Mosque, aka the Blue Mosque, it was the principal mosque of Istanbul. The Byzantine architecture of the Hagia Sophia served as inspiration for many other religious buildings from the Hagia Sophia, Thessaloniki and Panagia Ekatontapiliani to the Blue Mosque, the Şehzade Mosque, the Süleymaniye Mosque, the Rüstem Pasha Mosque and the Kılıç Ali Pasha Complex.
The complex remained a mosque until 1931, when it was closed to the public for four years. It was re-opened in 1935 as a museum by the secular Republic of Turkey. According to data released by the Ministry of Culture and Tourism, Hagia Sophia was Turkey's most visited tourist attraction in 2015 and 2019.
In early July 2020, the Council of State annulled the Cabinet's 1934 decision to establish the museum, revoking the monument's status, and a subsequent decree by Turkish president Recep Tayyip Erdoğan ordered the reclassification of Hagia Sophia as a mosque. The 1934 decree was ruled to be unlawful under both Ottoman and Turkish law as Hagia Sophia's "waqf", endowed by Sultan Mehmed, had designated the site a mosque; proponents of the decision argued the Hagia Sophia was the personal property of the sultan. This redesignation is controversial, invoking condemnation from the Turkish opposition, UNESCO, the World Council of Churches, the International Association of Byzantine Studies, and many international leaders.
History.
Church of Constantius II.
The first church on the site was known as the (), because of its larger dimensions in comparison to the contemporary churches in the city. According to the "Chronicon Paschale", the church was consecrated on 15 February 360, during the reign of the emperor Constantius II (), by the Arian bishop Eudoxius of Antioch. It was built next to the area where the Great Palace was being developed. According to the 5th-century ecclesiastical historian Socrates of Constantinople, the emperor Constantius had around 346 "constructed the Great Church alongside that called Irene which because it was too small, the emperor's father [Constantine] had enlarged and beautified". A tradition which is not older than the 7th or 8th century, reports that the edifice was built by Constantius' father, Constantine the Great (). Hesychius of Miletus wrote that Constantine built Hagia Sophia with a wooden roof, and removed 427 (mostly pagan) statues from the site. The 12th century chronicler Joannes Zonaras reconciles the two opinions, writing that Constantius had repaired the edifice consecrated by Eusebius of Nicomedia, after it had collapsed. Since Eusebius was bishop of Constantinople 339 to 341, and Constantine died in 337, it seems that the first church was erected by Constantius. 
The nearby Hagia Irene ("Holy Peace") church was completed earlier and served as cathedral until the Great Church was completed. Besides Hagia Irene, there is no record of any major churches in the city-centre before the late 4th century. Rowland Mainstone argued the 4th-century church was not yet known as Hagia Sophia. Though its name as the 'Great Church' implies it was larger than other Constantinopolitan churches, the only other major churches of the 4th century were the Church of St Mocius, which lay outside the Constantinian walls and was perhaps attached to a cemetery, and the Church of the Holy Apostles. 
The church itself is known to have had a timber roof, curtains, columns, and an entrance that faced west. It probably had a narthex, and is described as being shaped like a Roman circus. This may mean that it had a U-shaped plan like the basilicas of San Marcellino e Pietro and Sant'Agnese fuori le mura in Rome. However, it may also have been a more conventional three-, four-, or five-aisled basilica, perhaps resembling the original Church of the Holy Sepulchre in Jerusalem or the Church of the Nativity in Bethlehem. The building was likely preceded by an atrium, as in the later churches on the site.
According to Ken Dark and Jan Kostenec, a further remnant of the 4th century basilica may exist in a wall of alternating brick and stone banded masonry immediately to the west of the Justinianic church. The top part of the wall is constructed with bricks stamped with brick-stamps dating from the 5th century, but the lower part is of constructed of bricks typical of the 4th century. This wall was probably part of the propylaeum at the west front of both the Constantinian and Theodosian Great Church.
The building was accompanied by a baptistery and a "skeuophylakion". A hypogeum, perhaps with an martyrium above it, was discovered before 1946 and the surviving parts of a brick wall with traces of marble revetment were identified in 2004. The hypogeum was a tomb which may have been part of the 4th-century church or may have dated from the pre-Constantinian city of Byzantium. The "skeuophylakion" is said by Palladius to have circular plan, and because some U-shaped basilicas in Rome were funerary churches with attached circular mausolea (the Mausoleum of Constantina and the Mausoleum of Helena) it is possible it originally had a funerary function, though by 405 its use had changed. One much later account credited a woman called Anna with donating the land on which the church was built in return for the right to be buried there.
Excavations on the western side of the site of the first church under the propylaeum wall reveal that the first church was built atop a road some broad. According to early accounts, the first Hagia Sophia was built on the site of an ancient pagan temple, although there are no artefacts to confirm this. 
The Patriarch of Constantinople John Chrysostom came into a conflict with Empress Aelia Eudoxia, wife of the emperor Arcadius (), and was sent into exile on 20 June 404. During the subsequent riots, this first church was largely burnt down. Palladius noted that the 4th-century "skeuophylakion" survived the fire. According to Dark and Kostenec, the fire may only have affected the main basilica, leaving the surrounding ancillary buildings intact.
Church of Theodosius II.
A second church on the site was ordered by Theodosius II (), who inaugurated it on 10 October 415. The "Notitia Urbis Constantinopolitanae" describes the Hagia Sophia as the , while the former cathedral Hagia Irene is named the . At the time of Socrates of Constantinople around 440, "both churches are enclosed by a single wall and served by the same clergy". The complex would thus have encompassed a large area including the site of the later Hospital of Samson. If the fire of 404 destroyed only the 4th-century main basilica church, then the 5th century Theodosian basilica could have been built surrounded by a mainly 4th-century complex.
During the reign of Theodosius II, the emperor's elder sister, the "augusta" Pulcheria () came into conflict with the patriarch Nestorius (). The patriarch denied the "augusta" access to the sanctuary of the "Great Church", probably on the 15 April 428. According to the anonymous "Letter to Cosmas", the virgin empress, a promoter of the cult of the Virgin Mary and having habitually taken the Eucharist in the sanctuary under Nestorius's predecessors, claimed right of entry because of her equivalent position to the "Theotokos" – the Virgin Mary – "having given birth to God". Their theological differences were part of the controversy over the title "theotokos" that resulted in the Council of Ephesus and the stimulation of Monophysitism and Nestorianism, which like Nestorius objected to the title. Pulcheria, in common with Pope Celestine I and Patriarch Cyril of Alexandria, worked to overthrow Nestorius, condemn him at the ecumenical council, and exile him.
The area of the western entrance to the Justinianic Hagia Sophia revealed the western remains of its Theodosian predecessor, as well as some fragments of the Constantinian church. German archaeologist Alfons Maria Schneider began conducting archaeological excavations during the mid-1930s, publishing his final report in 1941. Excavations in the area that had once been the 6th-century atrium of the Justinianic church revealed the monumental western entrance and atrium, along with columns and sculptural fragments from both 4th- and 5th-century churches. Further digging was abandoned for fear of impinging on the integrity of the Justinianic building, but parts of the excavation trenches remain uncovered, laying bare the foundations of the Theodosian building.
The basilica was built by architect Rufinus. The church's main entrance faced west, perhaps with gilded doors, and with an additional entrance to the east. There was a central pulpit, and probably there was an upper gallery, possibly employed as a matroneum (women's section). The exterior was decorated with elaborate carvings with rich Theodosian-era designs, of which fragments survive, while the floor just inside the portico was embellished with polychrome mosaics. The surviving carved gable end from the centre of the western façade is decorated with a cross-roundel. Fragments of a frieze of reliefs with 12 lambs representing the 12 apostles also remain; unlike Justinian's 6th-century church the Theodosian Hagia Sophia had both colourful floor mosaics and external decorative sculpture.
At the western end, surviving stone fragments of the show there was vaulting, at least at the western end. The Theodosian building had a monumental propylaeum hall with a portico, which may account for this vaulting, which was thought by the original excavators in the 1930s to be part of the western entrance of the church itself. The propylaeum opened onto an atrium which lay in front of the basilica church itself. Preceding the propylaeum was a steep monumental staircase following the contours of the ground as it sloped away westwards in the direction of the Strategion, the Basilica, and the harbours of the Golden Horn. This arrangement would have recalled the steps outside the atrium of the Constantinian Old St Peter's Basilica in Rome. Nearby was a cistern, perhaps to supply a fountain in the atrium or for worshippers to wash with before entering.
The 4th-century "skeuophylakion" was replaced in the 5th century by the present-day structure, a rotunda constructed of banded masonry in the lower two levels and of plain brick masonry in the third. Originally this rotunda, probably employed as a treasury for liturgical objects, had a second-storey internal gallery accessed by an external spiral staircase and two levels of niches for storage. A further row, of windows with marble window frames on the third level remain bricked up. The gallery was supported on monumental consoles with carved acanthus designs, similar to those used on the late 5th-century Column of Leo. A large lintel of the "skeuophylakion"'s western entrance – bricked up in the Ottoman era – was discovered inside the rotunda when it was archaeologically cleared to its foundations in 1979, during which time the brickwork was also repointed. The "skeuophylakion" was again restored in 2014 by the Vakıflar.
A fire started during the tumult of the Nika Revolt, which had begun nearby in the Hippodrome of Constantinople, and the second Hagia Sophia was burnt to the ground on 13–14 January 532. The court historian Procopius wrote:
Church of Justinian I (current structure).
On 23 February 532, only a few weeks after the destruction of the second basilica, Emperor Justinian I decided to build a third and entirely different basilica, larger and more majestic than its predecessors. It was designed by Anthemius of Tralles and Isidore of Miletus.
Construction of the church began in 532 during the short term of Phocas as praetorian prefect. Phocas replaced John the Cappadocian after the Nika Riots saw the destruction of the Theodosian church, although he had previously been arrested in 529 on suspicion of paganism. According to John the Lydian, Phocas was responsible for funding the initial construction of the building with 4,000 Roman pounds of gold, although he was dismissed from office in October 532. John the Lydian, writing in the 550s, was careful to say Phocas had acquired the funds by moral means; Evagrius Scholasticus later wrote that he had obtained the money unjustly.
According to Anthony Kaldellis, both of Hagia Sophia's architects named by Procopius were associated with to the school of the pagan philosopher Ammonius of Alexandria. It is possible that both they and John the Lydian envisaged Hagia Sophia as a great temple of the supreme Neoplantonist deity whose visible manifestation was light and the sun. John the Lydian describes the church as the ""temenos" of the Great God" ().
Originally the exterior was covered with marble veneer, as indicated by remaining pieces of marble and surviving attachments for lost panels on the building's western face. The white marble cladding of much of the church, together with gilding of some parts, would have given Hagia Sophia a shimmering appearance quite different from the brick- and plaster-work of the modern period, and would greatly have increased its visibility from the sea. The cathedral's interior surfaces were sheathed with polychrome marbles, green and white with purple porphyry, and gold mosaics. The exterior was clad in stucco tinted yellow and red during restorations in the 19th century at the direction of the Fossati architects.
Justinian chose geometer and engineer Isidore of Miletus and mathematician Anthemius of Tralles as architects. The construction is described by Procopius's "On Buildings" (, ). Columns and other marbles were brought from all over the empire, throughout the Mediterranean. The idea of these columns being spoils from cities such as Rome and Ephesus is a later invention. Even though they were made specifically for Hagia Sophia, the columns show variations in size. More than ten thousand people were employed. This new church was contemporaneously recognized as a major work of architecture. Outside the church was an elaborate array of monuments around the bronze-plated Column of Justinian, topped by an equestrian statue of the emperor which dominated the Augustaeum, the open square outside the church which connected it with the Great Palace complex through the Chalke Gate. At the edge of the Augustaeum was the Milion and the Regia, the first stretch of Constantinople's main thoroughfare, the "Mese". Also facing the Augustaeum were the enormous Constantinian "thermae", the Baths of Zeuxippus, and the Justinianic civic basilica under which was the vast cistern known as the Basilica Cistern. On the opposite side of Hagia Sophia was the former cathedral, Hagia Irene. 
Referring to the destruction of the Theodosian Hagia Sophia and comparing the new church with the old, Procopius lauded the Justinianic building, writing in "De aedificiis":
When first seeing the finished building the Emperor is alleged to have said: "Salomon, I have surpassed thee"
Justinian and Patriarch Menas inaugurated the new basilica on 27 December 537 – 5 years and 10 months after construction started – with much pomp. Hagia Sophia was the seat of the Patriarchate of Constantinople and a principal setting for Byzantine imperial ceremonies, such as coronations. Like other churches throughout Christendom, the basilica offered sanctuary from persecution to outlaws.
Earthquakes in August 553 and on 14 December 557 caused cracks in the main dome and eastern semi-dome. According to the "Chronicle" of John Malalas, during a subsequent earthquake on 7 May 558, the eastern semi-dome fell down, destroying the ambon, altar, and ciborium. The collapse was due mainly to the unfeasibly high bearing load and to the enormous shear load of the dome, which was too flat. These caused the deformation of the piers which sustained the dome. Justinian ordered an immediate restoration. He entrusted it to Isidorus the Younger, nephew of Isidore of Miletus, who used lighter materials. The entire vault had to be taken down and rebuilt 20 Byzantine feet () higher than before, giving the building its current interior height of . Moreover, Isidorus changed the dome type, erecting a ribbed dome with pendentives whose diameter was between 32.7 and 33.5 m. Under Justinian's orders, eight Corinthian columns were disassembled from Baalbek, Lebanon, and shipped to Constantinople around 560. This reconstruction, giving the church its present 6th-century form, was completed in 562. The poet Paul the Silentiary composed a long Greek poem, an "ekphrasis", for the re-dedication of the basilica presided over by Patriarch Eutychius on 23 December 562. Paul the Silentiary's poem is conventionally known under the Latin title "Descriptio Sanctae Sophiae", and he was also author of another "ekphrasis" on the ambon of the church, the "Descripto Ambonis". The mosaics were completed in the reign of Emperor Justin II (), Justinian I's successor.
According to the history of the patriarch Nicephorus I and the chronicler Theophanes the Confessor, various liturgical vessels of the cathedral were melted down on the order of the emperor Heraclius () after the capture of Alexandria and Roman Egypt by the Sasanian Empire during the Byzantine–Sasanian War of 602–628. Theophanes states that these were made into gold and silver coins, and a tribute was paid to the Avars. The Avars attacked the extra-mural areas of Constantinople in 623, causing the Byzantines to move the "garment" relic () of Mary, mother of Jesus to Hagia Sophia from its usual shrine of the Church of the "Theotokos" at Blachernae just outside the Theodosian Walls. On 14 May 626, the "Scholae Palatinae", an elite body of soldiers, protested in Hagia Sophia against a planned increase in bread prices, after a stoppage of the "Cura Annonae" rations resulting from the loss of the grain supply from Egypt. The Persians under Shahrbaraz and the Avars together laid the Siege of Constantinople in 626; according to the "Chronicon Paschale", on 2 August 626 Theodore Syncellus, a deacon and presbyter of Hagia Sophia, was among those who negotiated unsuccessfully with the "khagan" of the Avars. A homily attributed by existing manuscripts to Theodore Syncellus, possibly delivered on the anniversary of the event, describes the translation of the Virgin's garment and its ceremonial re-translation to Blachernae by the patriarch Sergius I after the threat had passed. Another eyewitness to write an account of the Avar–Persian siege was George of Pisidia, a deacon of Hagia Sophia and an administrative official in for the patriarchate from Antioch in Pisidia. Both George and Theodore, probably belonged to Sergius's literary circle, attribute the defeat of the Avars to the intervention of the "Theotokos", a belief that strengthened in following centuries.
In 726, the emperor Leo the Isaurian issued a series of edicts against the veneration of images, ordering the army to destroy all icons – ushering in the period of Byzantine iconoclasm. At that time, all religious pictures and statues were removed from the Hagia Sophia. After a brief reprieve under Empress Irene (797–802), the iconoclasts made a comeback. The Emperor Theophilus () had two-winged bronze doors with his monograms installed at the southern entrance of the church.
The basilica suffered damage, first in a great fire in 859, and again in an earthquake on 8 January 869, that made one of the half-domes collapse. Emperor Basil I ordered the church repaired.
In his book "De caerimoniis aulae Byzantinae" ("Book of Ceremonies"), the emperor Constantine VII () wrote a detailed account of the ceremonies held in the Hagia Sophia by the emperor and the patriarch.
In the 940s or 950s, probably around 954 or 955, after the Rus'–Byzantine War of 941 and the death of the Grand Prince of Kiev, Igor I (), his widow Olga of Kiev – regent for her infant son Sviatoslav I () – visited the emperor Constantine VII and was received as queen of the Rus' in Constantinople. She was probably baptized in Hagia Sophia's baptistery, taking the name of the reigning "augusta", Helena Lecapena, and receiving the titles "zōstē patrikía" and the styles of "archontissa" and hegemon of the Rus'. Her baptism was an important step towards the Christianization of the Kievan Rus', though the emperor's treatment of her visit in "De caerimoniis" does not mention baptism. Olga is deemed a saint and equal-to-the-apostles () in the Eastern Orthodox Church. According to an early 14th-century source, the second church in Kiev, Saint Sophia's, was founded in "anno mundi" 6,460 in the Byzantine calendar, or CE. The name of this future cathedral of Kiev probably commemorates Olga's baptism at Hagia Sophia.
After the great earthquake of 25 October 989, which collapsed the western dome arch, Emperor Basil II asked for the Armenian architect Trdat, creator of the Cathedral of Ani, to direct the repairs. He erected again and reinforced the fallen dome arch, and rebuilt the west side of the dome with 15 dome ribs. The extent of the damage required six years of repair and reconstruction; the church was re-opened on 13 May 994. At the end of the reconstruction, the church's decorations were renovated, including the addition of four immense paintings of cherubs; a new depiction of Christ on the dome; a burial cloth of Christ shown on Fridays, and on the apse a new depiction of the Virgin Mary holding Jesus, between the apostles Peter and Paul. On the great side arches were painted the prophets and the teachers of the church.
According to the 13th-century Greek historian Niketas Choniates, in 1133 the emperor John II Comnenus celebrated a revived Roman triumph after his victory over the Danishmendids at the siege of Kastamon. After proceeding through the streets on foot carrying a cross, with a silver "quadriga" bearing the icon of the Virgin Mary, the emperor participated in a ceremony at the cathedral before entering the imperial palace. In 1168, another triumph was held by the emperor Manuel I Comnenus, again preceding with a gilded silver "quadriga" bearing the icon of the Virgin from the now-demolished East Gate (or Gate of St Barbara, later the ) in the Propontis Wall, to Hagia Sophia for a thanks-giving service, and then to the imperial palace.
In 1181, the daughter of the emperor Manuel I, Maria Comnena and her husband, the "caesar" Renier of Montferrat, fled to Hagia Sophia at the culmination of their dispute with the empress Maria of Antioch, regent for her son, the emperor Alexius II Comnenus. Maria Comnena and Renier occupied the cathedral with the support of the patriarch, refusing the demands of the imperial administration that they depart peaceably. According to Niketas Choniates, they "transformed the sacred courtyard into a military camp", garrisoned the entrances to the complex with locals and mercenaries, and despite the strong opposition of the patriarch, made the "house of prayer into a den of thieves or a well-fortified and precipitous stronghold, impregnable to assault", while "all the dwellings adjacent to Hagia Sophia and adjoining the Augusteion were demolished by her men". A battle ensued in the Augustaion and around the Milion, during which the defenders fought from the "gallery of the Catechumeneia (also called the Makron)" facing the Augusteion, from which they eventually retreated and took up positions in the exonarthex of Hagia Sophia itself. At this point, "the patriarch was anxious lest the enemy troops enter the temple, with unholy feet trample the holy floor, and with hands defiled and dripping with blood still warm plunder the all-holy dedicatory offerings". After a successful sally by Renier and his knights, Maria asked for a truce, the imperial assault ceased, and an amnesty was negotiated by the "megas doux" Andronikos Kontostephanos and the "megas hetaireiarches", John Doukas. Niketas Choniates compared the preservation of the cathedral to the efforts made by the 1st-century emperor Titus to avoid the destruction of the Second Temple during the Siege of Jerusalem in the First Jewish–Roman War. Niketas Choniates reports that in 1182, a white hawk wearing jesses was seen to fly from the east to Hagia Sophia, flying three times from the "building of the "Thōmaitēs"" (a basilica erected on the southeastern side of the Augustaion) to the Palace of the Kathisma in the Great Palace, where new emperors were acclaimed. This was supposed to presage the end of the reign of Andronicus I Comnenus ().
 
According to the Greek historian Niketas Choniates, in 1203 during the Fourth Crusade, the emperors Isaac II Angelus and Alexius IV Angelus stripped Hagia Sophia of all the gold ornaments and all the silver oil-lamps in order to pay off the Crusaders who had ousted Alexius III Angelus and helped Isaac return to the throne. Upon the subsequent Sack of Constantinople in 1204, the church was further ransacked and desecrated by the Crusaders, as described by Niketas, though he did not witness the events in person. According to his account, composed at the court of the rump Empire of Nicaea, Hagia Sophia was stripped of its remaining metal ornaments, its altar was smashed into pieces, and a "woman laden with sins" sang and danced on the synthronon. He adds that mules and donkeys were brought into the cathedral's sanctuary to carry away the gilded silver plating of the bema, the ambo, and the doors and other furnishings, and that one of these slipped on the marble floor and was accidentally disembowelled, further contaminating the place. According to Ali ibn al-Athir, whose treatment of the Sack of Constantinople was probably dependent on a Christian source, the Crusaders massacred some clerics who had surrendered to them. Much of the interior was damaged and would not be repaired until its return to Orthodox control in 1261. The sack of Hagia Sophia, and Constantinople in general, remained a sore point in Catholic–Eastern Orthodox relations.
During the Latin occupation of Constantinople (1204–1261) the church became a Latin Catholic cathedral. Baldwin I of Constantinople () was crowned emperor on 16 May 1204 in Hagia Sophia, at a ceremony which closely followed Byzantine practices. Enrico Dandolo, the Doge of Venice who commanded the sack and invasion of the city by the Latin Crusaders in 1204, is buried inside the church, probably in the upper eastern gallery. In the 19th century, an Italian restoration team placed a cenotaph marker, frequently mistaken as being a medieval, near the probable location and still visible today. The original tomb was destroyed by the Ottomans during the conversion of the church into a mosque.
At the capture of Constantinople in 1261 by the Empire of Nicaea and the emperor Michael VIII Palaeologus, () the church was in a dilapidated state. In 1317, emperor Andronicus II Palaeologus () ordered four new buttresses () to be built in the eastern and northern parts of the church, financing them with the inheritance of his late wife, Irene of Montferrat (1314). New cracks developed in the dome after the earthquake of October 1344, and several parts of the building collapsed on 19 May 1346; consequently, the church was closed until 1354, when repairs were undertaken by architects Astras and Peralta.
On 12 December 1452, Isidore of Kiev proclaimed in Hagia Sophia the long-anticipated and short-lived ecclesiastical union between the western Catholic and eastern Orthodox Churches as decided at the Council of Florence and the papal bull "Laetentur Caeli". The union was unpopular among the Byzantines, who had already expelled the Patriarch of Constantinople, Gregory III, for his pro-union stance. A new patriarch was not installed until after the Ottoman conquest. According to the Greek historian Doukas, the Hagia Sophia was tainted by these Catholic associations, and the anti-union Orthodox faithful avoided the cathedral, considering it to be a haunt of demons and a "Hellenic" temple of Roman paganism. Doukas also notes that after the "Laetentur Caeli" was proclaimed, the Byzantines dispersed discontentedly to nearby venues where they drank toasts to the Hodegetria icon, which had, according to late Byzantine tradition, interceded to save them in the former sieges of Constantinople by the Avar Khaganate and the Umayyad Caliphate.
According to "Nestor Iskander's Tale on the Taking of Tsargrad", the Hagia Sophia was the focus of an alarming omen interpreted as the Holy Spirit abandoning Constantinople on 21 May 1453, in the final days of the Siege of Constantinople. The sky lit up, illuminating the city, and "many people gathered and saw on the Church of the Wisdom, at the top of the window, a large flame of fire issuing forth. It encircled the entire neck of the church for a long time. The flame gathered into one; its flame altered, and there was an indescribable light. At once it took to the sky. … The light itself has gone up to heaven; the gates of heaven were opened; the light was received; and again they were closed." This phenomenon was perhaps St Elmo's fire induced by gunpowder smoke and unusual weather. The author relates that the fall of the city to "Mohammadenism" was foretold in an omen seen by Constantine the Great – an eagle fighting with a snake – which also signified that "in the end Christianity will overpower Mohammedanism, will receive the Seven Hills, and will be enthroned in it".
The eventual fall of Constantinople had long been predicted in apocalyptic literature. A reference to the destruction of a city founded on seven hills in the "Book of Revelation" was frequently understood as Constantinople, and the "Apocalypse of Pseudo-Methodius" had predicted an "Ishmaelite" conquest of the Roman Empire. In this text, the Muslim armies reach the "Forum Bovis" before being turned back by divine intervention; in apocalyptic later texts, the climactic turn takes place at the Column of Theodosius nearer Hagia Sophia, in others, at the Column of Constantine, closer still. Hagia Sophia is mentioned in a hagiography, of uncertain date, detailing the life of the fictional saint Andrew the Fool. The text's author claims to have been Nicephorus, a priest of Hagia Sophia, and contains a description of the end time in the form of a dialogue, in which the interlocutor, on being told by the saint that Constantinople will be sunk in a flood, and that "the waters as they gush forth will irresistibly deluge her and cover her and surrender her to the terrifying and immense sea of the abyss", says "some people say that the Great Church of God will not be submerged with the city but will be suspended in the air by an invisible power". The reply is given that "When the whole city sinks into the sea, how can the Great Church remain? Who will need her? Do you think God dwells in temples made with hands?" The Column of Constantine, however, is prophesied to endure.
From the time of Procopius in the reign of Justinian, the equestrian imperial statue on the Column of Justinian in the Augustaion beside Hagia Sophia, which gestured towards Asia with right hand, was understood to represent the emperor holding back the threat to the Romans from the Sasanian Empire in the Roman–Persian Wars, while the orb or "globus cruciger" held in the statue's left was an expression of the global power of the Roman emperor. Subsequently, in the Arab–Byzantine wars, the threat held back by the statue became the Umayyad Caliphate, and later still the statue was thought to be fending off the advance of the Turks. The identity of the emperor was often confused with other famous saint-emperors like Theodosius the Great and Heraclius. The orb was frequently referred to as an apple in foreigners' accounts of the city, and was interpreted in Greek folklore as a symbol of the Turks' mythological homeland in Central Asia, the "Lone Apple Tree". The orb fell to the ground in 1316 and was replaced by 1325, but while it was still in place in 1421/2, by the time Johann Schiltberger saw it in 1427 the "empire-apple" () had fallen to the earth. An attempt to raise it again in 1435 failed, and this amplified the prophecies of the city's fall. For the Turks, the "red apple" () came to symbolize first Constantinople itself and then the military supremacy of the Islamic caliphate over the Christian empire. In Niccolò Barbaro's account of the fall of the city in 1453, the Justinianic monument was interpreted in the last days of the siege as representing the city's founder Constantine the Great, indicating "this is the way my conqueror will come".
According to Laonicus Chalcocondyles, Hagia Sophia was a refuge for the population during the capture of the city. Despite the ill-repute and empty state of Hagia Sophia after December 1452, Doukas writes that after the Theodosian Walls were breached, the Byzantines took refuge there as the Turks advanced through the city: "All the women and men, monks, and nuns ran to the Great Church. They, both men and women, were holding in their arms their infants. … What a spectacle! That street was crowded, full of human beings." He attributes their change of heart to a prophecy.
Mosque (1453–1935).
Constantinople fell to the attacking Ottoman forces on 29 May 1453. Sultan Mehmed entered the city and performed the Friday prayer and "khutbah" (sermon) in Hagia Sophia, this action marked the official conversion of Hagia Sophia into a mosque.
In accordance with the traditional custom at the time, Sultan Mehmed II allowed his troops and his entourage three full days of unbridled pillage and looting in the city shortly after it was captured. Once the three days passed, he would then claim its remaining contents for himself. According to the "Encyclopædia Britannica" Mehmed II "permitted an initial period of looting that saw the destruction of many Orthodox churches". However, by the end of the first day, he proclaimed that the looting should cease as he felt profound sadness when he toured the looted and enslaved city. 
Hagia Sophia was not exempted from the pillage and looting and specifically became its focal point as the invaders believed it to contain the greatest treasures and valuables of the city. Shortly after the defence of the Walls of Constantinople collapsed and the Ottoman troops entered the city victoriously, the pillagers and looters made their way to the Hagia Sophia and battered down its doors before storming in.
Throughout the period of the siege of Constantinople, the trapped worshippers of the city participated in the Divine Liturgy and the Prayer of the Hours at the Hagia Sophia and the church formed a safe-haven and a refuge for many of those who were unable to contribute to the city's defence, which comprised women, children, elderly, the sick and the wounded. Being trapped in the church, the many congregants and yet more refugees inside became spoils-of-war to be divided amongst the triumphant invaders. The building was desecrated and looted, with the helpless occupants who sought shelter within the church being enslaved. While most of the elderly and the infirm/wounded and sick were killed, the remainder (mainly teenage males and young boys) were chained up and sold into slavery.
The church's priests and religious personnel continued to perform Christian rites, prayers and ceremonies until finally being forced to stop by the invaders. When Sultan Mehmed and his entourage entered the church, he ordered that it be converted into a mosque at once. One of the "ʿulamāʾ" (Islamic scholars) present climbed onto the church's ambo and recited the "shahada" ("There is no god but God, and Muhammed is his messenger"), thus marking the beginning of the conversion of the church into a mosque. Mehmed is reported to have taken a sword to a soldier who tried to prise up one of the paving slabs of the Proconnesian marble floor.
As described by Western visitors before 1453, such as the Córdoban nobleman Pero Tafur and the Florentine geographer Cristoforo Buondelmonti, the church was in a dilapidated state, with several of its doors fallen from their hinges; Mehmed II ordered a renovation of the building. Mehmed attended the first Friday prayer in the mosque on 1 June 1453. Aya Sofya became the first imperial mosque of Istanbul. To the corresponding "waqf" were endowed most of the existing houses in the city and the area of the future Topkapı Palace. From 1478, 2,360 shops, 1,300 houses, 4 caravanserais, 30 "boza" shops, and 23 shops of sheep heads and trotters gave their income to the foundation. Through the imperial charters of 1520 (AH 926) and 1547 (AH 954) shops and parts of the Grand Bazaar and other markets were added to the foundation.
Before 1481, a small minaret was erected on the southwest corner of the building, above the stair tower. Later, Mehmed's successor Bayezid II () built another minaret at the northeast corner. One of these collapsed after the earthquake of 1509, and around the middle of the 16th century they were both replaced by two diagonally opposite minarets built at the east and west corners of the edifice. In 1498, Bernardo Bonsignori was the last Western visitor to Hagia Sophia to report seeing the ancient Justinianic floor; shortly afterwards the floor was covered over with carpet and not seen again until the 19th century.
In the 16th century, Sultan Suleiman the Magnificent () brought two colossal candlesticks from his of the Kingdom of Hungary and placed them on either side of the "mihrab". During Suleiman's reign, the mosaics above the narthex and imperial gates depicting Jesus, Mary and various Byzantine emperors were covered by whitewash and plaster, which was removed in 1930 under the Turkish Republic.
During the reign of Selim II (), the building started showing signs of fatigue and was extensively strengthened with the addition of structural supports to its exterior by Ottoman architect Mimar Sinan, who was also an earthquake engineer. In addition to strengthening the historic Byzantine structure, Sinan built the two additional large minarets at the western end of the building, the original sultan's lodge and the türbe (mausoleum) of Selim II to the southeast of the building in 1576–1577 / AH 984. In order to do that, parts of the Patriarchate at the south corner of the building were pulled down the previous year. Moreover, the golden crescent was mounted on the top of the dome, while a respect zone 35 "arşin" (about 24 m) wide was imposed around the building, pulling down all the houses which in the meantime had nested around it. Later his türbe hosted also 43 tombs of Ottoman princes. Murad III () had two large alabaster Hellenistic urns transported from Pergamon (Bergama) and placed on two sides of the nave.
In 1594 / AH 1004 "Mimar" (court architect) Davud Ağa built the türbe of Murad III, where the Sultan and his "valide", Safiye Sultan were later buried. The octagonal mausoleum of their son Mehmed III () and his "valide" was built next to it in 1608 (AH 1017) by royal architect Dalgiç Mehmet Aĝa. His son Mustafa I () converted the baptistery into his türbe.
In 1717, under Sultan Ahmed III (), the crumbling plaster of the interior was renovated, contributing indirectly to the preservation of many mosaics, which otherwise would have been destroyed by mosque workers. In fact, it was usual for them to sell the mosaic's tesserae—believed to be talismans—to the visitors. Sultan Mahmud I ordered the restoration of the building in 1739 and added a "medrese" (a Koranic school, subsequently the library of the museum), an "imaret" (soup kitchen for distribution to the poor) and a library, and in 1740 a "Şadirvan" (fountain for ritual ablutions), thus transforming it into a "külliye", i.e. a social complex. At the same time, a new sultan's lodge and a new mihrab were built inside.
Renovation of 1847–1849.
Restoration of the Hagia Sophia was ordered by Sultan Abdulmejid I () and completed by eight hundred workers between 1847 and 1849, under the supervision of the Swiss-Italian architect brothers Gaspare and Giuseppe Fossati. The brothers consolidated the dome with a restraining iron chain and strengthened the vaults, straightened the columns, and revised the decoration of the exterior and the interior of the building. The mosaics in the upper gallery were exposed and cleaned, although many were recovered "for protection against further damage". 
Eight new gigantic circular-framed discs or medallions were hung from the cornice, on each of the four piers and at either side of the apse and the west doors. These were painted, to designs by the calligrapher Kazasker Mustafa Izzet Efendi (1801–1877), with the names of Allah, Muhammad, the Rashidun (the first four caliphs: Abu Bakr, Umar, Uthman and Ali), and the two grandsons of Muhammad: Hasan and Husayn, the sons of Ali. The old chandeliers were replaced by new pendant ones.
In 1850 the architects Fossati built a new maqsura or caliphal loge in Neo-Byzantine columns and an Ottoman–Rococo style marble grille, connecting to the royal pavilion behind the mosque. The new maqsura was built at the extreme east end of the northern aisle, next to the north-eastern pier. The existing maqsura in the apse, near the mihrab, was demolished. A new entrance was constructed for the sultan: the . The Fossati brothers also renovated the minbar and mihrab.
Outside the main building, the minarets were repaired and altered so that they were of equal height. A clock building, the was built by the Fossatis for the use of the muwaqqit (the mosque timekeeper), and a new madrasa (Islamic school) was constructed. The was also built under their direction. When the restoration was finished, the mosque was re-opened with ceremonial pomp on 13 July 1849. An edition of lithographs from drawings made during the Fossatis' work on Hagia Sophia was published in London in 1852, entitled: "Aya Sophia of Constantinople as Recently Restored by Order of H.M. The Sultan Abdulmedjid".
Museum (1935–2020).
In 1935, the first Turkish President and founder of the Republic of Turkey, Mustafa Kemal Atatürk, transformed the building into a museum. The carpet and the layer of mortar underneath them were removed and marble floor decorations such as the "omphalion" appeared for the first time since the Fossatis' restoration, while the white plaster covering many of the mosaics was removed. Nevertheless, the condition of the structure deteriorated, and the World Monuments Fund (WMF) placed Hagia Sophia on 1996 World Monuments Watch, and again in 1998. The building's copper roof had cracked, causing water to leak down over the fragile frescoes and mosaics. Moisture entered from below as well. Rising ground water had raised the level of humidity within the monument, creating an unstable environment for stone and paint. The WMF secured a series of grants from 1997 to 2002 for the restoration of the dome. The first stage of work involved the structural stabilization and repair of the cracked roof, which was undertaken with the participation of the Turkish Ministry of Culture. The second phase, the preservation of the dome's interior, afforded the opportunity to employ and train young Turkish conservators in the care of mosaics. By 2006, the WMF project was complete, though many other areas of Hagia Sophia continue to require significant stability improvement, restoration and conservation.
In 2014, Hagia Sophia was the second most visited museum in Turkey, attracting almost 3.3 million visitors annually.
While use of the complex as a place of worship (mosque or church) was strictly prohibited, in 1991 the Turkish government allowed the allocation of a pavilion in the museum complex ("Ayasofya Müzesi Hünkar Kasrı") to be used as a prayer room, and since 2013, two of the museum's minarets had been used for voicing the call to prayer (the ezan) regularly. 
In 2007, Greek American politician Chris Spirou launched an international organization "Free Agia Sophia Council" championing the cause of restoring the building to its original function as a Christian church. From the early 2010s, several campaigns and government high officials, notably Turkey's deputy prime minister Bülent Arınç in November 2013, had demanded that Hagia Sophia be converted into a mosque again. In 2015, in response to the acknowledgement by Pope Francis of the Armenian Genocide, which is officially denied in Turkey, the mufti of Ankara, Mefail Hızlı, said that he believed that the Pope's remarks would accelerate the conversion of Hagia Sophia into a mosque.
On 1 July 2016, Muslim prayers were held again in the Hagia Sophia for the first time in 85 years. On November, the Turkish non-governmental organization, the "Association for the Protection of Historic Monuments and the Environment" filed a lawsuit for converting the museum into a mosque. The court decided it should stay as a 'monument museum'. In October 2016, Turkey's Directorate of Religious Affairs ("Diyanet") appointed, for the first time in 81 years, a designated imam, Önder Soy, to the Hagia Sofia mosque ("Ayasofya Camii Hünkar Kasrı"), located at the "Hünkar Kasrı", a pavilion for the sultans' private ablutions. Since then, the adhan has been regularly called out from the Hagia Sophia's all four minarets five times a day.
On 13 May 2017 a large group of people, organized by the Anatolia Youth Association (AGD), gathered in front of Hagia Sophia and prayed the morning prayer with a call for the re-conversion of the museum into a mosque. On 21 June 2017 the Directorate of Religious Affairs ("") organized a special programme, broadcast live by state-run television TRT, which included the recitation of the Quran and prayers in Hagia Sofia, to mark the Laylat al-Qadr.
Reversion to mosque (2018–present).
Since 2018, Turkish president Recep Tayyip Erdoğan had spoken of reverting the status of the Hagia Sophia back to a mosque, a move seen to be very popularly accepted by the religious populace whom Erdoğan is attempting to persuade. On 31 March 2018 Erdoğan recited the first verse of the Quran in the Hagia Sophia, dedicating the prayer to the "souls of all who left us this work as inheritance, especially Istanbul's conqueror," strengthening the political movement to make the Hagia Sophia a mosque once again, which would reverse Atatürk's measure of turning the Hagia Sophia into a secular museum. In March 2019 Erdoğan said that he would change the status of Hagia Sophia from a museum to a mosque, adding that it had been a "very big mistake" to turn it into a museum. As a UNESCO World Heritage site, this change would require approval from UNESCO's World Heritage Committee. In late 2019 Erdoğan's office took over the administration and upkeep of the nearby Topkapı Palace Museum, transferring responsibility for the site from the Ministry of Culture and Tourism by presidential decree.
In 2020, Turkey's government celebrated the 567th anniversary of the Fall of Constantinople with an Islamic prayer in Hagia Sophia. Turkish president Recep Tayyip Erdoğan said during a televised broadcast "Al-Fath surah will be recited and prayers will be done at Hagia Sophia as part of conquest festival". In May, during the anniversary events, passages from the Quran was read in the Hagia Sophia. Greece condemned this action, while Turkey in response accused Greece of making “futile and ineffective statements”.
In June, the head of the Turkey's Directorate of Religious Affairs () said that "we would be very happy to open Hagia Sophia for worship" and if this happens "we will provide our religious services as we do in all our mosques”. On 25 June, John Haldon, president of the International Association of Byzantine Studies, wrote an open letter to Erdoğan asking that he "consider the value of keeping the Aya Sofya as a museum".
On 10 July 2020, the decision of the Council of Ministers to transform the Hagia Sophia into a museum was cancelled by the Council of State, decreeing that Hagia Sophia can be used only as a mosque and not “for any other purpose”. Despite secular and global criticism, Erdoğan signed a decree annulling the Hagia Sophia's museum status, reverting it to a mosque. The call to prayer was broadcast from the minarets shortly after the announcement of the change and rebroadcast by major Turkish news networks. The Hagia Sophia Museum's social media channels were taken down the same day, with Erdoğan announcing at a press conference that prayers themselves would be held there from 24 July. A presidential spokesperson said it would become a working mosque, open to anyone similar to the Parisian churches Sacré-Cœur and Notre-Dame. The spokesperson also said that the change would not affect the status of the Hagia Sophia as a UNESCO World Heritage site, and that "Christian icons" within it would continue to be protected. Earlier the same day, before the final decision, the Turkish Finance and Treasury Minister Berat Albayrak and the Justice Minister Abdulhamit Gül expressed their expectations of opening the Hagia Sophia to worship for Muslims. Mustafa Şentop, Speaker of Turkey's Grand National Assembly, said "a longing in the heart of our nation has ended". A presidential spokesperson claimed that all political parties in Turkey supported Erdoğan's decision; however, the Peoples' Democratic Party had previously released a statement denouncing the decision, saying "decisions on human heritage cannot be made on the basis of political games played by the government". The mayor of Istanbul, Ekrem İmamoğlu, said that he supports the conversion "as long as it benefits Turkey", adding that he always said that Hagia Sophia is a mosque and for him it has remained a mosque since 1453. Ali Babacan attacked the policy of his former ally Erdoğan, saying the Hagia Sophia issue "has come to the agenda now only to cover up other problems". Orhan Pamuk, Turkish novelist and Nobel laureate, publicly denounced the move, saying "Kemal Atatürk changed ... Hagia Sophia from a mosque to a museum, honouring all previous Greek Orthodox and Latin Catholic history, making it as a sign of Turkish modern secularism".
On 17 July, Erdoğan announced that the first prayers in the Hagia Sophia would be open to between 1,000 and 1,500 worshippers, and reiterated that the issue was a matter of Turkey's sovereignty and international reaction would not deter him. Turkey invited foreign leaders and officials, including Pope Francis, for the first prayers which was held on Friday on July 24, 2020, in the Hagia Sophia.
On 22 July, a turquoise-coloured carpet was laid to prepare the mosque for worshippers; Ali Erbaş, head of the "Diyanet", attended its laying. The "omphalion" was left exposed. Because of the COVID-19 pandemic in Turkey, Erbaş said Hagia Sophia would accommodate up to 1,000 worshippers at a time and asked that they bring "masks, a prayer rug, patience and understanding". The mosque opened for Friday prayers on 24 July, the 97th anniversary of the signature of the Treaty of Lausanne, which after the victory of the Republic in the Turkish War of Independence, reversed many of the territorial losses Turkey incurred after World War I's Treaty of Sèvres, including ending the Allies' occupation of Constantinople. White drapes covered the mosaics of the Virgin and Child in the apse. Erbaş, holding a sword, proclaimed during his sermon, "Sultan Mehmet the Conqueror dedicated this magnificent construction to believers to remain a mosque until the Day of Resurrection". Erdoğan and some government ministers attended the midday prayers as many worshippers prayed outside; at one point the security cordon was breached and dozens of people broke through police lines. It is the fourth Byzantine church converted from museum to a mosque during Erdoğan's rule.
International reaction.
Days before the final decision on the conversion was made, Ecumenical Patriarch Bartholomew I of Constantinople stated in a sermon that "the conversion of Hagia Sophia into a mosque would disappoint millions of Christians around the world”, he also said that Hagia Sophia, which was "a vital center where East is embraced with the West", would "fracture these two worlds" in the event of conversion. The proposed conversion was decried by other Orthodox Christian leaders, the Russian Orthodox Church's Patriarch Kirill of Moscow stating that "a threat to Hagia Sophia [wa]s a threat to all of Christian civilization".
Following the Turkish government's decision, UNESCO announced it "deeply regret[ted]" the conversion "made without prior discussion", and asked Turkey to "open a dialogue without delay", stating that the lack of negotiation was "regrettable". UNESCO further announced that the "state of conservation" of Hagia Sophia would be "examined" at the next session of the World Heritage Committee, urging Turkey "to initiate dialogue without delay, in order to prevent any detrimental effect on the universal value of this exceptional heritage". Ernesto Ottone, UNESCO’s Assistant Director-General for Culture said "It is important to avoid any implementing measure, without prior discussion with UNESCO, that would affect physical access to the site, the structure of the buildings, the site's moveable property, or the site’s management". UNESCO's statement of 10 July said "these concerns were shared with the Republic of Turkey in several letters, and again yesterday evening with the representative of the Turkish Delegation" without a response.
The World Council of Churches, which claims to represent 500 million Christians of 350 denominations, condemned the decision to convert the building into a mosque, saying that would "inevitably create uncertainties, suspicions and mistrust"; the World Council of Churches urged Turkey's president Erdoğan "to reconsider and reverse" his decision "in the interests of promoting mutual understanding, respect, dialogue and cooperation, and avoiding cultivating old animosities and divisions". At the recitation of the Sunday Angelus prayer at St Peter's Square on 12 July Pope Francis said, "My thoughts go to Istanbul. I think of Santa Sophia and I am very pained" (). The International Association of Byzantine Studies announced that its 21st International Congress, due to be held in Istanbul in 2021, will no longer be held there and is postponed to 2022.
Josep Borrell, the European Union's High Representative for Foreign Affairs and Vice-President of the European Commission, released a statement calling the decisions by the Council of State and Erdoğan "regrettable" and pointing out that "as a founding member of the Alliance of Civilisations, Turkey has committed to the promotion of inter-religious and inter-cultural dialogue and to fostering of tolerance and co-existence." According to Borrell, the European Union member states' twenty-seven foreign ministers "condemned the Turkish decision to convert such an emblematic monument as the Hagia Sophia" at meeting on 13 July, saying it "will inevitably fuel the mistrust, promote renewed division between religious communities and undermine our efforts at dialog and cooperation" and that "there was a broad support to call on the Turkish authorities to urgently reconsider and reverse this decision". Greece denounced the conversion and considered it a breach of the UNESCO World Heritage titling. Greek culture minister Lina Mendoni called it an "open provocation to the civilised world" which "absolutely confirms that there is no independent justice" in Erdoğan's Turkey, and that his Turkish nationalism "takes his country back six centuries". Greece and Cyprus called for EU sanctions on Turkey. Morgan Ortagus, the spokesperson for the United States Department of State, noted: "We are disappointed by the decision by the government of Turkey to change the status of the Hagia Sophia." Jean-Yves Le Drian, foreign minister of France, said his country "deplores" the move, saying "these decisions cast doubt on one of the most symbolic acts of modern and secular Turkey". Vladimir Dzhabarov, deputy head of the foreign affairs committee of the Russian Federation Council, said that it "will not do anything for the Muslim world. It does not bring nations together, but on the contrary brings them into collision" and calling the move a "mistake". The former deputy prime minister of Italy, Matteo Salvini, held a demonstration in protest outside the Turkish consulate in Milan, calling for all plans for accession of Turkey to the European Union to be terminated "once and for all". In East Jerusalem, a protest was held outside the Turkish consulate on the 13 July, with the burning of a Turkish flag and the display of the Greek flag and flag of the Greek Orthodox Church. In a statement the Turkish foreign ministry condemned the burning of the flag, saying "nobody can disrespect or encroach our glorious flag".
Ersin Tatar, prime minister of the Turkish Republic of Northern Cyprus, which is recognized only by Turkey, welcomed the decision, calling it "sound" and "pleasing". He further criticized the government of Cyprus, claiming that "the Greek Cypriot administration, who burned down our mosques, should not have a say in this". Through a spokesman the Foreign Ministry of Iran welcomed the change, saying the decision was an "issue that should be considered as part of Turkey's national sovereignty" and "Turkey's internal affair". Sergei Vershinin, deputy foreign minister of Russia, said that the matter was of one of "internal affairs, in which, of course, neither we nor others should interfere." The Arab Maghreb Union was supportive. Ekrema Sabri, imam of the al-Aqsa Mosque, and Ahmed bin Hamad al-Khalili, grand mufti of Oman, both congratulated Turkey on the move. The Muslim Brotherhood was also in favour of the news. A spokesman for the Palestinian Islamist movement Hamas called the verdict "a proud moment for all Muslims". Pakistani politician Chaudhry Pervaiz Elahi of the Pakistan Muslim League (Q) welcomed the ruling, claiming it was "not only in accordance with the wishes of the people of Turkey but the entire Muslim world". The Muslim Judicial Council group in South Africa praised the move, calling it "a historic turning point". In Nouakchott, capital of Mauritania, there were prayers and celebrations topped by the sacrifice of a camel. On the other hand, Shawki Allam, grand mufti of Egypt, ruled that conversion of the Hagia Sophia to a mosque is "impermissible".
When President Erdoğan announced that the first Muslim prayers would be held inside the building on 24 July, he added that "like all our mosques, the doors of Hagia Sophia will be wide open to locals and foreigners, Muslims and non-Muslims." Presidential spokesman İbrahim Kalın said that the icons and mosaics of the building would be preserved, and that "in regards to the arguments of secularism, religious tolerance and coexistence, there are more than four hundred churches and synagogues open in Turkey today." Ömer Çelik, spokesman for the ruling Justice and Development Party (AKP), announced on 13 July that entry to Hagia Sophia would be free of charge and open to all visitors outside prayer times, during which Christian imagery in the building's mosaics would be covered by curtains or lasers. In response to the criticisms of Pope Francis, Çelik said that the papacy was responsible for the greatest disrespect done to the site, during the 13th-century Latin Catholic Fourth Crusade's sack of Constantinople and the Latin Empire, during which the cathedral was pillaged. The Turkish foreign minister, Mevlüt Çavuşoğlu, told TRT Haber on 13 July that the government was surprised at the reaction of UNESCO, saying that "We have to protect our ancestors’ heritage. The function can be this way or that way – it does not matter".
On 14 July the prime minister of Greece, Kyriakos Mitsotakis, said his government was "considering its response at all levels" to what he called Turkey's "unnecessary, petty initiative", and that "with this backward action, Turkey is opting to sever links with western world and its values". In relation to both Hagia Sophia and the Cyprus–Turkey maritime zones dispute, Mitsotakis called for European sanctions against Turkey, referring to it as "a regional troublemaker, and which is evolving into a threat to the stability of the whole south-east Mediterranean region". Dora Bakoyannis, Greek former foreign minister, said Turkey's actions had "crossed the Rubicon", distancing itself from the West. On the day of the building's re-opening, Mitsotakis called it not a show of power but evidence of Turkey's weakness.
Architecture.
Hagia Sophia is one of the greatest surviving examples of Byzantine architecture. Its interior is decorated with mosaics and marble pillars and coverings of great artistic value. The temple itself was so richly and artistically decorated that according to much later legend, Justinian proclaimed, "Solomon, I have outdone thee!" (). Justinian himself had overseen the completion of the greatest cathedral ever built up to that time, and it was to remain the largest cathedral for 1,000 years up until the completion of the cathedral in Seville in Spain.
The Hagia Sophia is of masonry construction. The structure has brick and mortar joints that are 1.5 times the width of the bricks. The mortar joints are composed of a combination of sand and minute ceramic pieces distributed evenly throughout the mortar joints. This combination of sand and potsherds was often used in Roman concrete, predecessor of modern concrete.
Justinian's basilica was at once the culminating architectural achievement of late antiquity and the first masterpiece of Byzantine architecture. Its influence, both architecturally and liturgically, was widespread and enduring in the Eastern Christianity, Western Christianity, and Islam alike.
The vast interior has a complex structure. The nave is covered by a central dome which at its maximum is from floor level and rests on an arcade of 40 arched windows. Repairs to its structure have left the dome somewhat elliptical, with the diameter varying between . 
At the western entrance side and eastern liturgical side, there are arched openings extended by half domes of identical diameter to the central dome, carried on smaller semi-domed exedrae; a hierarchy of dome-headed elements built up to create a vast oblong interior crowned by the central dome, with a clear span of .The theories of Hero of Alexandria, a Hellenistic mathematician of the 1st century AD, may have been utilized to address the challenges presented by building such an expansive dome over so large a space. The idea is that formula_1, which is not expressible as a rational number, was approximated and deliberately used as a less accurate rational value that approximates the irrational number formula_1. This is appropriate for 22/7 which was used for solving circle problems in construction. When it is ascertained that the circle circumference is U=D*22/7, several elegant solutions are produced, among them those which use a diameter which is cancelling the denominator. As thus Svenshon and Stiffel proposed that the architects used Heron's proposed values for constructing vaults. Central for the erection of the dome of the Hagia Sophia was that the central square corresponds to a diagonal, which is expressible as a rational number approximating formula_3. If this was not rightly done, all related measures to the square would not be manageable by the instruments of the surveyors of those times. As thus for the calculation of the square measurements derived from the so-called side-and-diagonal number progression were used. With its help, approximations for formula_3 can be produced, which is essential for measuring all types of square or square-related objects and surfaces (i.e. 1/1, 3/2, 7/5, 17/12, 41/29, 99/70). With this method, the squares defined by the numbers 12 and 17, whereas 12 defines the side of the square and 17 its diagonal, has been used as a standard value as early as in cuneiform Babylonian texts.
As the great square in Hagia Sophia is 31 m long, it was previously thought, without any reassurance, that this length corresponded to 100 Byzantine feet. Yet such a round figure for the square side would lead to a diagonal with the irrational length of 141.421... because of the factor formula_3. This would mean that the square and all dimensions related to it would not be manageable. It has now been realised that in this context, the diagonal is nothing else but the diameter of the circle defined by the vault's circumference, while at the same time, as Heron's circle calculations, in which the practical diameter-values 7 and 14 were used, that the diagonal of the square, or diameter of the circle has been calculated with the tenfold of the exemplary value of 14 or else 140 Byzantine feet. If the dimension of the dome diameter of the Hagia Sophia is constructed with a value that fits to the approximation of formula_1 (22/7) all derived values become rational: 70*22/7=220; 105*22/7=330; 140*22/7=440, ... 210*22/7=660.
Therefore, Svenshon suggested that the size of the side of the central square of Hagia Sophia is not 100 Byzantine feet, but instead 99. This measurement is not only rational, but is also embedded in the system of the side-and-diagonal number progression (70/99) and therefore a usable value by the applied mathematics of antiquity. It gives a diagonal of 140 which is manageable for constructing a huge dome as was done in the Hagia Sophia.
Floor.
The stone floor of Hagia Sophia dates from the 6th century. After the first collapse of the vault, the broken dome was left "in situ" on the original Justinianic floor and a new floor laid above the rubble when the dome was rebuilt in 558. From the installation of this second Justinianic floor, the floor became part of the liturgy, with significant locations and spaces demarcated in various ways with different coloured stones and marbles.
The floor is predominantly of Proconnesian marble, quarried on Proconnesus (Marmara Island) in the Propontis (Sea of Marmara). This was the main white marble used in Constantinople's monuments. Other parts of the floor were quarried in Thessaly in Roman Greece: the Thessalian verd antique "marble". The Thessalian verd antique bands across the nave floor were often likened to rivers.
The floor was praised by numerous authors and repeatedly compared to a sea. The Justinianic poet Paul the Silentiary compared the ambo and the solea connecting it with the sanctuary to an island in a sea, with the sanctuary itself a harbour. The 9th-century "Narratio" writes of it as "like the sea or the flowing waters of a river". Michael the Deacon in the 12th century also described the floor as a sea in which the ambo and other liturgical furniture stood as islands. In the 15th-century conquest of Constantinople, the Ottoman caliph Mehmed is said to have ascended to the dome and the galleries in order to admire the floor, which according to Tursun Beg resembled "a sea in a storm" or a "petrified sea". Other Ottoman-era authors also praised the floor; Tâcîzâde Cafer Çelebi compared it to waves of marble. The floor was hidden beneath a carpet on 22 July 2020.
Narthex and portals.
The Imperial Gate was the main entrance between the exo- and esonarthex. It was reserved exclusively for the Emperor. The Byzantine mosaic above the portal depicts Christ and an unnamed emperor. A long ramp from the northern part of the outer narthex leads up to the upper gallery.
Upper gallery.
The upper gallery, the matroneum, is laid out in a horseshoe shape that encloses the nave on three sides and is interrupted by the apse. Several mosaics are preserved in the upper gallery, an area traditionally reserved for the Empress and her court. The best-preserved mosaics are located in the southern part of the gallery.
The upper gallery contains runic graffiti presumed to be left by members of the Varangian Guard.
Throughout history the Hagia Sophia has been a victim to natural disasters, such as earthquakes, and has also fallen victim to vandalism. Structural damage can easily be seen on its exterior surface. To ensure that the Hagia Sophia did not sustain any damage on the interior of the building, studies have been conducted using ground penetrating radar within the gallery of the Hagia Sophia. With the use of GPR (ground penetrating radar), teams discovered weak zones within the Hagia Sophia's gallery and also concluded that the curvature of the vault dome has been shifted out of proportion, compared to its original angular orientation.
Dome.
The dome of Hagia Sophia has spurred particular interest for many art historians, architects and engineers because of the innovative way the original architects envisioned it. The dome is carried on four spherical triangular pendentives, one of the first large-scale uses of them. The pendentives are the corners of the square base of the dome, which curve upwards into the dome to support it, restraining the lateral forces of the dome and allowing its weight to flow downwards. It was the largest pendentive dome in the world until the completion of St Peter's Basilica, and has a much lower height than any other dome of such a large diameter.
The great dome at the Hagia Sophia is 32.6 meters (one hundred and seven feet) in diameter and is only 0.61 meters (two feet) thick. The main building material for the Hagia Sophia composed of brick and mortar. Brick aggregate was used to make roofs easier to construct. The aggregate weighs 2402.77 kilograms per cubic meter (one hundred and fifty pounds per cubic foot), an average weight of masonry construction at the time. Due to the materials plasticity it was chosen over cut stone due to the fact that aggregate can be used over a longer distance. According to Rowland Mainstone, "it is unlikely that the vaulting-shell is anywhere more than one normal brick in thickness".
The weight of the dome remained a problem for most of the building's existence. The original cupola collapsed entirely after the earthquake of 558; in 563 a new dome was built by Isidore the younger, a nephew of Isidore of Miletus. Unlike the original, this included 40 ribs and was raised 6.1 meters (20 feet), in order to lower the lateral forces on the church walls. A larger section of the second dome collapsed as well, in two episodes, so that today only two sections of the present dome, in the north and south side, still date from the 562 reconstructions. Of the whole dome's 40 ribs, the surviving north section contains eight ribs, while the south section includes six ribs.
Although this design stabilizes the dome and the surrounding walls and arches, the actual construction of the walls of Hagia Sophia weakened the overall structure. The bricklayers used more mortar than brick, which is more effective if the mortar was allowed to settle as the building would have been more flexible; however, the builders raced to complete the building and left no time for the mortar to cure before they began the next layer. When the dome was erected, its weight caused the walls to lean outward because of the wet mortar underneath. When Isidore the Younger rebuilt the fallen cupola, he had first to build up the interior of the walls to make them vertical again. Additionally, the architect raised the height of the rebuilt dome by approximately so that the lateral forces would not be as strong and its weight would be transmitted more effectively down into the walls. Moreover, he shaped the new cupola like a scalloped shell or the inside of an umbrella, with ribs that extend from the top down to the base. These ribs allow the weight of the dome to flow between the windows, down the pendentives, and ultimately to the foundation.
Hagia Sophia is famous for the light that reflects everywhere in the interior of the nave, giving the dome the appearance of hovering above. This effect was achieved by inserting forty windows around the base of the original structure. Moreover, the insertion of the windows in the dome structure reduced its weight.
Buttresses.
Numerous buttresses have been added throughout the centuries. The flying buttresses to the west of the building, although thought to have been constructed by the Crusaders upon their visit to Constantinople, were actually built during the Byzantine era. This shows that the Romans had prior knowledge of flying buttresses, which can also be seen at in Greece, at the Rotunda of Galerius in Thessaloniki, at the monastery of Hosios Loukas in Boeotia, and in Italy at the octagonal basilica of San Vitale in Ravenna. Other buttresses were constructed during the Ottoman times under the guidance of the architect Sinan. A total of 24 buttresses were added.
Minarets.
The minarets were an Ottoman addition and not part of the original church's Byzantine design. They were built for notification of invitations for prayers ("adhan") and announcements. Mehmed had built a wooden minaret over one of the half domes soon after Hagia Sophia's conversion from a cathedral to a mosque. This minaret does not exist today. One of the minarets (at southeast) was built from red brick and can be dated back from the reign of Mehmed or his successor Beyazıd II. The other three were built from white limestone and sandstone, of which the slender northeast column was erected by Bayezid II and the two identical larger minarets to the west were erected by Selim II and designed by the famous Ottoman architect Mimar Sinan. Both are in height, and their thick and massive patterns complete Hagia Sophia's main structure. Many ornaments and details were added to these minarets on repairs during the 15th, 16th, and 19th centuries, which reflect each period's characteristics and ideals.
Notable elements and decorations.
Originally, under Justinian's reign, the interior decorations consisted of abstract designs on marble slabs on the walls and floors, as well as mosaics on the curving vaults. Of these mosaics, one can still see the two archangels Gabriel and Michael in the spandrels (corners) of the bema. There were already a few figurative decorations, as attested by the late 6th-century "ekphrasis" of Paul the Silentiary, the "Description of Hagia Sophia". The spandrels of the gallery are faced in inlaid thin slabs ("opus sectile"), showing patterns and figures of flowers and birds in precisely cut pieces of white marble set against a background of black marble. In later stages, figurative mosaics were added, which were destroyed during the iconoclastic controversy (726–843). Present mosaics are from the post-iconoclastic period.
Apart from the mosaics, many figurative decorations were added during the second half of the 9th century: an image of Christ in the central dome; Eastern Orthodox saints, prophets and Church Fathers in the tympana below; historical figures connected with this church, such as Patriarch Ignatius; and some scenes from the Gospels in the galleries. Basil II let artists paint on each of the four pendentives a giant six-winged seraph. The Ottomans covered their faces with a golden star, but in 2009 one of them was restored to the original state.
Loggia of the Empress.
The loggia of the empress is located in the centre of the gallery of the Hagia Sophia, above the Imperial Door and directly opposite the apse. From this matroneum (women's gallery), the empress and the court-ladies would watch the proceedings down below. A green stone disc of verd antique marks the spot where the throne of the empress stood.
Lustration urns.
Two huge marble lustration (ritual purification) urns were brought from Pergamon during the reign of Sultan Murad III. From the Hellenistic period, they are carved from single blocks of marble.
Marble Door.
The Marble Door inside the Hagia Sophia is located in the southern upper enclosure or gallery. It was used by the participants in synods, who entered and left the meeting chamber through this door. It is said that each side is symbolic and that one side represents heaven while the other represents hell. Its panels are covered in fruits and fish motives. The door opens into a space that was used as a venue for solemn meetings and important resolutions of patriarchate officials.
The Nice Door.
The Nice Door is the oldest architectural element found in the Hagia Sophia dating back to the 2nd century BC. The decorations are of reliefs of geometric shapes as well as plants that are believed to have come from a pagan temple in Tarsus in Cilicia, part of the Cibyrrhaeot Theme in modern-day Mersin Province in south-eastern Turkey. It was incorporated into the building by Emperor Theophilos in 838 where it is placed in the south exit in the inner narthex.
Imperial Door.
The Imperial Door is the door that would be used solely by the Emperor as well as his personal bodyguard and retinue. It is the largest door in the Hagia Sophia and has been dated to the 6th century. It is about 7 meters long and Byzantine sources say it was made with wood from Noah's Ark.
Wishing column.
At the northwest of the building, there is a column with a hole in the middle covered by bronze plates. This column goes by different names; the "perspiring" or "sweating column", the "crying column", or the "wishing column". The column is said to be damp when touched and have supernatural powers. The legend states that since Gregory the Wonderworker appeared near the column in the year 1200, it has been moist. It is believed that touching the moisture cures many illnesses.
Mosaics.
The first mosaics which adorned the church were completed during the reign of Justin II. Many of the non-figurative mosaics in the church come from this period. Most of the mosaics, however, were created in the 10th and 12th centuries, following the periods of Byzantine Iconoclasm.
During the Sack of Constantinople in 1204, the Latin Crusaders vandalized valuable items in every important Byzantine structure of the city, including the golden mosaics of the Hagia Sophia. Many of these items were shipped to Venice, whose Doge, Enrico Dandolo, had organized the invasion and sack of Constantinople after an agreement with Prince Alexios Angelos, the son of a deposed Byzantine emperor.
19th-century restoration.
Following the building's conversion into a mosque in 1453, many of its mosaics were covered with plaster, due to Islam's ban on representational imagery. This process was not completed at once, and reports exist from the 17th century in which travellers note that they could still see Christian images in the former church. In 1847–1849, the building was restored by two Swiss-Italian Fossati brothers, Gaspare and Giuseppe, and Sultan Abdulmejid I allowed them to also document any mosaics they might discover during this process, which were later archived in Swiss libraries. This work did not include repairing the mosaics and after recording the details about an image, the Fossatis painted it over again. The Fossatis restored the mosaics of the two "hexapteryga" (singular , pr. hexapterygon, six-winged angel; it is uncertain whether they are seraphim or cherubim) located on the two east pendentives, covering their faces again before the end of the restoration. The other two placed on the west pendentives are copies in paint created by the Fossatis since they could find no surviving remains of them. As in this case, the architects reproduced in paint damaged decorative mosaic patterns, sometimes redesigning them in the process. The Fossati records are the primary sources about a number of mosaic images now believed to have been completely or partially destroyed in the 1894 Istanbul earthquake. These include a mosaic over a now-unidentified "Door of the Poor", a large image of a jewel-encrusted cross, and many images of angels, saints, patriarchs, and church fathers. Most of the missing images were located in the building's two tympana.
One mosaic they documented is Christ Pantocrator in a circle, which would indicate it to be a ceiling mosaic, possibly even of the main dome which was later covered and painted over with Islamic calligraphy that expounds God as the light of the universe. The Fossatis' drawings of the Hagia Sophia mosaics are today kept in the Archive of the Canton of Ticino.
20th-century restoration.
Many mosaics were uncovered in the 1930s by a team from the Byzantine Institute of America led by Thomas Whittemore. The team chose to let a number of simple cross images remain covered by plaster but uncovered all major mosaics found.
Because of its long history as both a church and a mosque, a particular challenge arises in the restoration process. Christian iconographic mosaics can be uncovered, but often at the expense of important and historic Islamic art. Restorers have attempted to maintain a balance between both Christian and Islamic cultures. In particular, much controversy rests upon whether the Islamic calligraphy on the dome of the cathedral should be removed, in order to permit the underlying Pantocrator mosaic of Christ as Master of the World, to be exhibited (assuming the mosaic still exists).
The Hagia Sophia has been a victim to natural disasters that have caused deterioration to the buildings structure and walls. The deterioration of the Hagia Sophia's walls can be directly related to salt crystallization. The crystallization of salt is due to an intrusion of rainwater that is at fault for the Hagia Sophia's deteriorating inner and outer walls. Diverting excess rainwater is the main solution to solve the deteriorating walls at the Hagia Sophia.
Built between 532–537 a subsurface structure under the Hagia Sophia has been under investigation, using LaCoste-Romberg gravimeters to determine the depth of the subsurface structure and to discover other hidden cavities beneath the Hagia Sophia. The hidden cavities have also acted as a support system against earthquakes. With these findings using the LaCoste-Romberg gravimeters, it was also discovered that the Hagia Sophia's foundation is built on a slope of natural rock.
Imperial Gate mosaic.
The Imperial Gate mosaic is located in the tympanum above that gate, which was used only by the emperors when entering the church. Based on style analysis, it has been dated to the late 9th or early 10th century. The emperor with a nimbus or halo could possibly represent emperor Leo VI the Wise or his son Constantine VII Porphyrogenitus bowing down before Christ Pantocrator, seated on a jewelled throne, giving his blessing and holding in his left hand an open book. The text on the book reads: "Peace be with you" (, ) and "I am the light of the world" (). On each side of Christ's shoulders is a circular medallion with busts: on his left the Archangel Gabriel, holding a staff, on his right his mother Mary.
Southwestern entrance mosaic.
The southwestern entrance mosaic, situated in the tympanum of the southwestern entrance, dates from the reign of Basil II. It was rediscovered during the restorations of 1849 by the Fossatis. The Virgin sits on a throne without a back, her feet resting on a pedestal, embellished with precious stones. The Christ Child sits on her lap, giving his blessing and holding a scroll in his left hand. On her left side stands emperor Constantine in ceremonial attire, presenting a model of the city to Mary. The inscription next to him says: "Great emperor Constantine of the Saints". On her right side stands emperor Justinian I, offering a model of the Hagia Sophia. The medallions on both sides of the Virgin's head carry the nomina sacra and , abbreviations of the . The composition of the figure of the Virgin enthroned was probably copied from the mosiac inside the semi-dome of the apse inside the liturgical space.
Apse mosaics.
The mosaic in the semi-dome above the apse at the east end shows Mary, mother of Jesus holding the Christ Child and seated on a jewelled "thokos" backless throne. Since its rediscovery after a period of concealment in the Ottoman era, it "has become one of the foremost monuments of Byzantium". The infant Jesus's garment is depicted with golden "tesserae".
, who had travelled to Constantinople, in 1672 engraved and in 1680 published in Paris an image of the interior of Hagia Sophia which shows the apse mosaic indistinctly. Together with a picture by Cornelius Loos drawn in 1710, these images are early attestations of the mosiac before it was covered towards the end of the 18th century. The mosaic of the Virgin and Child was rediscovered during the restorations of the Fossati brothers in 1847–1848 and revealed by the restoration of Thomas Whittemore in 1935–1939. It was studied again in 1964 with the aid of scaffolding.
It is not known when this mosaic was installed. According to Cyril Mango, the mosaic is "a curious reflection on how little we know about Byzantine art". The work is generally believed to date from after the end of Byzantine Iconoclasm and usually dated to the patriarchate of Photius I () and the time of the emperors Michael III () and Basil I (). Most specifically, the mosaic has been connected with a surviving homily known to have been written and delivered by Photius in the cathedral on 29 March 867.
Other scholars have favoured earlier or later dates for the present mosaic or its composition. Nikolaos Oikonomides pointed out that Photius's homily refers to standing portrait of the "Theotokos" – a "Hodegetria" – while the present mosaic shows her seated. Likewise, a biography of the patriarch Isidore I () by his successor Philotheus I () composed before 1363 describes Isidore seeing a standing image of the Virgin at Epiphany in 1347. Serious damage was done to the building by earthquakes in the 14th century, and it is possible that a standing image of the Virgin that existed in Photius's time was lost in the earthquake of 1346, in which the eastern end of Hagia Sophia was partly destroyed. This interpretation supposes that the present mosaic of the Virgin and Child enthroned is of the late 14th century, a time in which, beginning with Nilus of Constantinople (), the patriarchs of Constantinople began to have official seals depicting the "Theotokos" enthroned on a "thokos".
Still other scholars have proposed an earlier date than the later 9th century. According to George Galavaris, the moasic seen by Photius was a "Hodegetria" portrait which after the earthquake of 989 was replaced by the present image not later than the early 11th century. According to Oikonomides however, the image in fact dates to before the Triumph of Orthodoxy, having been completed , during the iconodule interlude between the First Iconoclast (726–787) and the Second Iconoclast (814–842) periods. Having been plastered over in the Second Iconoclasm, Oikonomides argues a new, standing image of the Virgin "Hodegetria" was created above the older mosaic in 867, which then fell off in the earthquakes of the 1340s and revealed again the late 8th-century image of the Virgin enthroned.
More recently, analysis of a hexaptych menologion icon panel from Saint Catherine's Monastery at Mount Sinai has determined that the panel, showing numerous scenes from the life of the Virgin and other theologically significant iconic representations, contains an image at the centre very similar to that in Hagia Sophia. The image is labelled in Greek merely , but in the Georgian language the inscription reveals the image is labelled "of the semi-dome of Hagia Sophia". This image is therefore the oldest depiction of the apse mosaic known and demonstrates that the apse mosaic's appearance was similar to the present day mosaic in the late 11th or early 12th centuries, when the hexaptych was inscribed in Georgian by a Georgian monk, which rules out a 14th-century date for the mosaic.
The portraits of the archangels Gabriel and Michael (largely destroyed) in the bema of the arch also date from the 9th century. The mosaics are set against the original golden background of the 6th century. These mosaics were believed to be a reconstruction of the mosaics of the 6th century that were previously destroyed during the iconoclastic era by the Byzantines of that time, as represented in the inaugural sermon by the patriarch Photios. However, no record of figurative decoration of Hagia Sophia exists before this time.
Emperor Alexander mosaic.
The Emperor Alexander mosaic is not easy to find for the first-time visitor, located on the second floor in a dark corner of the ceiling. It depicts the emperor Alexander in full regalia, holding a scroll in his right hand and a globus cruciger in his left. A drawing by the Fossatis showed that the mosaic survived until 1849 and that Thomas Whittemore, founder of the Byzantine Institute of America who was granted permission to preserve the mosaics, assumed that it had been destroyed in the earthquake of 1894. Eight years after his death, the mosaic was discovered in 1958 largely through the researches of Robert Van Nice. Unlike most of the other mosaics in Hagia Sophia, which had been covered over by ordinary plaster, the Alexander mosaic was simply painted over and reflected the surrounding mosaic patterns and thus was well hidden. It was duly cleaned by the Byzantine Institute's successor to Whittemore, Paul A. Underwood.
Empress Zoe mosaic.
The Empress Zoe mosaic on the eastern wall of the southern gallery date from the 11th century. Christ Pantocrator, clad in the dark blue robe (as is the custom in Byzantine art), is seated in the middle against a golden background, giving his blessing with the right hand and holding the Bible in his left hand. On either side of his head are the "nomina sacra" ' and ', meaning "Iēsous Christos". He is flanked by Constantine IX Monomachus and Empress Zoe, both in ceremonial costumes. He is offering a purse, as a symbol of donation, he made to the church, while she is holding a scroll, symbol of the donations she made. The inscription over the head of the emperor says: "Constantine, pious emperor in Christ the God, king of the Romans, Monomachus". The inscription over the head of the empress reads as follows: "Zoë, the very pious Augusta". The previous heads have been scraped off and replaced by the three present ones. Perhaps the earlier mosaic showed her first husband Romanus III Argyrus or her second husband Michael IV. Another theory is that this mosaic was made for an earlier emperor and empress, with their heads changed into the present ones.
Comnenus mosaic.
The Comnenus mosaic, also located on the eastern wall of the southern gallery, dates from 1122. The Virgin Mary is standing in the middle, depicted, as usual in Byzantine art, in a dark blue gown. She holds the Christ Child on her lap. He gives his blessing with his right hand while holding a scroll in his left hand. On her right side stands emperor John II Comnenus, represented in a garb embellished with precious stones. He holds a purse, symbol of an imperial donation to the church. his wife, the empress Irene of Hungary stands on the left side of the Virgin, wearing ceremonial garments and offering a document. Their eldest son Alexius Comnenus is represented on an adjacent pilaster. He is shown as a beardless youth, probably representing his appearance at his coronation aged seventeen. In this panel, one can already see a difference with the Empress Zoe mosaic that is one century older. There is a more realistic expression in the portraits instead of an idealized representation. The Empress Irene (born "Piroska"), daughter of Ladislaus I of Hungary, is shown with plaited blond hair, rosy cheeks, and grey eyes, revealing her Hungarian descent. The emperor is depicted in a dignified manner.
Deësis mosaic.
The Deësis mosaic (, "Entreaty") probably dates from 1261. It was commissioned to mark the end of 57 years of Latin Catholic use and the return to the Eastern Orthodox faith. It is the third panel situated in the imperial enclosure of the upper galleries. It is widely considered the finest in Hagia Sophia, because of the softness of the features, the humane expressions and the tones of the mosaic. The style is close to that of the Italian painters of the late 13th or early 14th century, such as Duccio. In this panel the Virgin Mary and John the Baptist ("Ioannes Prodromos"), both shown in three-quarters profile, are imploring the intercession of Christ Pantocrator for humanity on Judgment Day. The bottom part of this mosaic is badly deteriorated. This mosaic is considered as the beginning of a renaissance in Byzantine pictorial art.
Northern tympanum mosaics.
The northern tympanum mosaics feature various saints. They have been able to survive due to their high and inaccessible location. They depict Patriarchs of Constantinople John Chrysostom and Ignatius standing, clothed in white robes with crosses, and holding richly jewelled Bibles. The figures of each patriarch, revered as saints, are identifiable by labels in Greek. The other mosaics in the other tympana have not survived probably due to the frequent earthquakes, as opposed to any deliberate destruction by the Ottoman conquerors.
Dome mosaic.
The dome was decorated with four non-identical figures of the six-winged angels which protect the Throne of God; it is uncertain whether they are seraphim or cherubim. The mosaics survive in the eastern part of the dome, but since the ones on the western side were damaged during the Byzantine period, they have been renewed as frescoes. During the Ottoman period each seraph's (or cherub's) face was covered with metallic lids in the shape of stars, but these were removed to reveal the faces during renovations in 2009.
Works modelled on the Hagia Sophia.
 
Many religious buildings have been modeled on the Hagia Sophia's core structure of a large central dome resting on pendentives and buttressed by two semi-domes.
Many Byzantine churches were modeled on the Hagia Sophia including the namesake Hagia Sophia in Thessaloniki, Greece. Under Justinian, the Hagia Irene was remodeled to have a dome similar to the Hagia Sophia.
Several mosques commissioned by the Ottoman dynasty closely mimic the geometry of the Hagia Sophia, including the Süleymaniye Mosque and the Bayezid II Mosque. In many cases, Ottoman architects preferred to surround the central dome with four semi-domes rather than two. This is true in the Sultan Ahmed Mosque, the New Mosque (Istanbul), and the Fatih Mosque. Like the original plan of the Hagia Sophia, many of these mosques are also entered through a colonnaded courtyard. However, the courtyard of the Hagia Sophia no longer exists.
Neo-Byzantine churches modeled on the Hagia Sophia include the Kronstadt Naval Cathedral and Poti Cathedral which closely replicate the internal geometry of the Hagia Sophia. The interior of the Kronstadt Naval Cathedral is a nearly 1-to-1 copy of the Hagia Sophia. The marble revetment also closely mimics the source work. Like Ottoman mosques, many churches based on the Hagia Sophia include four semi-domes rather than two, such as the Church of Saint Sava in Belgrade.
Several churches combine the layout of the Hagia Sophia with a Latin cross plan. For instance, the Cathedral Basilica of Saint Louis (St. Louis), where the transept is formed by two semi-domes surrounding the main dome. This church also closely emulates the column capitals and mosaic styles of the Hagia Sophia. Other similar examples include the Alexander Nevsky Cathedral, Sofia, St Sophia's Cathedral, London, Saint Clement Catholic Church, Chicago, and Basilica of the National Shrine of the Immaculate Conception.
The Catedral Metropolitana Ortodoxa in São Paulo and the Église du Saint-Esprit (Paris) closely follow the interior layout of the Hagia Sophia. Both include four semi-domes, but the two lateral semi-domes are very shallow. In terms of size, the Église du Saint-Esprit is about two-thirds the scale of the Hagia Sophia.
Synagogues based on the Hagia Sophia include the Congregation Emanu-El (San Francisco), Great Synagogue of Florence, and Hurva Synagogue.
Further reading.
 Articles 
 Mosaics 