With high recognition, the Great Church was paired with the new imperial palace of Constantinople's emperor. It became an integral part of the thriving empire until riots from the Patriarch's exile sent the monument down in flames. .
The second church was established in the year 415 AD. Also sporting a wooden roof, it was considered to be a step forward for the new empire. Roman Christianity was in practice at the new chapel and stood in the same position as the previous structure. Unfortunately, the cathedral also became victim to the flames. A large amount marble blocks from the second church survived the disaster and are still viewable near the third church today. Among these relics are reliefs that depict 12 lambs, which represent the 12 apostles. Originally part of a monumental front entrance, these fragments now reside in an excavation pit adjacent to Hagia Sophia's entrance, after a 1935 discovery by A. M. Schneider beneath the western courtyard. Any additional remains from the second church may have survived, and are yet to be discovered. However, due to the unstable integrity of the aging cathedral, the anticipation for future excavations has been diminished.
As mentioned before, Constantinople was in terrible condition before Justinian took rule in 527. In an effort to revive ancient Rome, he started a program to make Constantinople greater than ever. By doing so, he made an effort to rebuild the greatest monument of the capital: the church of Hagia Sophia. Justinian did not have time to lose, for he began construction just a few weeks after the previous church was set ablaze. By comparison, the new basilica was larger than the previous incarnations on the property and was more beautifully designed as well. He hired two of the greatest architects in the empire, a physicist named Isidore of Miletus and the mathematician Anthemius of Trallesalthough, although the latter died a year after the project commenced.