stylistic:tone
Middle Ages

Serdica became part of the First Bulgarian Empire during the reign of Khan Krum in 809, after a long siege. The fall of the strategic city prompted a major and ultimately disastrous invasion of Bulgaria by the Byzantine emperor Nikephoros I, which led to his demise at the hands of the Bulgarian army. In the aftermath of the war, the city was permanently integrated in Bulgaria and became known by the Slavic name of Sredets. It grew into an important fortress and administrative centre under Krum's successor Khan Omurtag, who made it a centre of Sredets province (Sredetski komitat, Средецки комитат). The Bulgarian patron saint John of Rila was buried in Sredets by orders of Emperor Peter I in the mid 10th century. After the conquest of the Bulgarian capital Preslav by Sviatoslav I of Kyiv and John I Tzimiskes ' armies in 970–971, the Bulgarian Patriarch Damyan chose Sredets for his seat in the next year and the capital of Bulgaria was temporarily moved there. In the second half of 10th century the city was ruled by Komit Nikola and his sons, known as the " Komitopuli ". One of them was Samuil, who was eventually crowned Emperor of Bulgaria in 997. In 986, the Byzantine Emperor Basil II laid siege to Sredets but after 20 days of fruitless assaults the garrison broke out and forced the Byzantines to abandon the campaign. On his way to Constantinople, Basil II was ambushed and soundly defeated by the Bulgarians in the battle of the Gates of Trajan.

The city eventually fell to the Byzantine Empire in 1018, following the Byzantine conquest of Bulgaria. Sredets joined the uprising of Peter Delyan in 1040–1041 in a failed attempt to restore Bulgarian independence and was the last stronghold of the rebels, led by the local commander Botko. During the 11th century many Pechenegs were settled down in Sofia region as Byzantine federats.

It was once again incorporated into the restored Bulgarian Empire in 1194 at the time of Emperor Ivan Asen I and became a major administrative and cultural centre. Several of the city's governors were members of the Bulgarian imperial family and held the title of sebastokrator, the second highest at the time, after the tsar. Some known holders of the title were Kaloyan, Peter and their relative Aleksandar Asen (d. after 1232), a son of Ivan Asen I of Bulgaria (r. 1189–1196). In the 13th and 14th centuries Sredets was an important spiritual and literary hub with a cluster of 14 monasteries in its vicinity, that were eventually destroyed by the Ottomans. The city produced multicolored sgraffito ceramics, jewelry and ironware.

In 1382/1383 or 1385, Sredets was seized by the Ottoman Empire in the course of the Bulgarian-Ottoman Wars by Lala Şahin Pasha, following a three-month siege. The Ottoman commander left the following description of the city garrison: "Inside the fortress there is a large and elite army, its soldiers are heavily built, moustached and look war-hardened, but are used to consume wine and rakia —in a word, jolly fellows."