Russo-Turkish War (1877-78): Sofia is liberated from Ottoman rule and becomes capital of Liberated Bulgaria in 1879.

The Battle of Sofia (Bulgarian: ) was the culmination of Russian General Iosif Gurko's Western Squad for the defeat of the Orhaniye army in the Russo-Turkish War (18771878). It led to the Liberation of Sofia from Turkish rule.

The Russo-Turkish War of 1877–1878 (Turkish: 93 Harbi, lit. 'War of ’93', named for the year 1293 in the Islamic calendar; Russian: Русско-турецкая война, romanized: Russko-turetskaya voyna, "Russian–Turkish war") was a conflict between the Ottoman Empire and the Eastern Orthodox Christians coalition led by the Russian Empire and composed of Bulgaria, Romania, Serbia, and Montenegro. Fought in the Balkans and in the Caucasus, it originated in emerging 19th century Balkan nationalism. Additional factors included the Russian goals of recovering territorial losses endured during the Crimean War of 1853–56, re-establishing itself in the Black Sea and supporting the political movement attempting to free Balkan nations from the Ottoman Empire.

The Russian-led coalition won the war, pushing the Ottomans back all the way to the gates of Constantinople, leading to the intervention of the western European great powers.

As a result, Russia succeeded in claiming provinces in the Caucasus, namely Kars and Batum, and also annexed the Budjak region. The principalities of Romania, Serbia, and Montenegro, each of which had had de facto sovereignty for some years, formally proclaimed independence from the Ottoman Empire. After almost five centuries of Ottoman domination (1396–1878), an autonomous Bulgarian state emerged with the help and military intervention of Russia: the Principality of Bulgaria, covering the land between the Danube River and the Balkan Mountains (except Northern Dobrudja which was given to Romania), as well as the region of Sofia, which became the new state's capital. The Congress of Berlin in 1878 also allowed Austria-Hungary to occupy Bosnia and Herzegovina and Great Britain to take over Cyprus.

The initial Treaty of San Stefano, signed on 3 March 1878, is today celebrated on Liberation Day in Bulgaria, although the occasion somewhat fell out of favour during the years of Communist rule.