Medieval Sredets
Sofia first became part of the First Bulgarian Empire during the reign of Khan Krum in 809 C.E. Afterwards, it was known by the Bulgarian name Sredets and grew into an important fortress and administrative center.
After a number of unsuccessful sieges, the city fell again to the Byzantine Empire in 1018 C.E. In 1128 C.E., Sredets suffered a Magyar raid as part of the Byzantine Empire, but in 1191 C.E. it was once again incorporated into the restored Bulgarian Empire at the time of Tsar Ivan Asen I after the Vlach-Bulgarian Rebellion.
From the 12th to the 14th century, Sofia was a thriving center of trade and crafts. It was renamed Sofia (meaning "wisdom" in Greek) in 1376 C.E. after the Church of St Sophia. However, it was called both "Sofia" and "Sredets" until the 16th century, when the new name gradually replaced the old one.
During the whole of the Middle Ages, Sofia remained known for its gold-smithing, particularly aided by the wealth of mineral resources in the neighboring mountains. This is evidenced by the number of gold treasures excavated from the period and even from Antiquity.