Church was built in the middle of the vast eastern necropolis in Serdica situated on both sides of the road leading to Constantinople. It is assumed that the first church – a martyrion – dates back to the Edict of Milan in 313 AD. Soon afterwards the martyrion was turned into a single nave church and, most probably under Emperor Valent (364-378), replaced with a three nave church. The fourth reconstruction happened during the reign of Theodosius (379-395) towards the end of the fourth century AD. This church was probably destroyed by the Huns. The erection of the fifth church, which has survived to the present day, is considered to have occured in the second half of the fifth century AD or the first half of the sixth century AD. The opinion that it dates back to the rule of Justinian (527-565) has taken hold. The “Sveta Sophia” (Wisdom of God) Church is dedicated to Christ. It is a vaulted, cruciform, three nave basilica with a cupola and esonarthex. The presence of elements from both eastern and western church architecture determines the style as transitional between Byzantine and Roman architecture. It was built according to the principle of the so-called ”golden ratio”. Its size is 46.45 metres to 20.20 metres. The height of the cupola is 19.75 metres and its diameter is 9 metres. Its foundations reach nearly five metres underground. Around the eighth or the ninth century AD there were new renovations of the church. It was turned into a metropolitan church and high-ranking clergymen and secular officials were buried there.
The basilica gave its name to the city. It was in 1382, in Tsar Ivan Shishman's charter, given to the Dragalevtsi monastery, that Sredec was called Sofia for the first time.
During Ottoman rule the church was turned into a mosque. A caravanseray and a dervish tekke were built to it.
In 1515, in the vicinity of “Sveta Sophia” Church, St. Georgi Novi Sofiyski – a martyr for the Christian faith – was burned at the stake. Heavy earthquakes in 1818 and 1858 destroyed part of the mosque and it was abandoned.
The church – a symbol of the city – is the first reconstructed archeological monument in the capital. The patron icon “Hagia Sophia – the Wisdom of God” is by the painter Gospodin Zhelyazkov and was painted according to the ideas of Metropolitan Stefan, being unique in the Orthodox world for its depiction of the Holy Trinity.
In the 1980s and the 1990s, the church was restored and conserved and a memorial to the Unknown Warrior – Eternal Fire – was built on its southern facade.