The Russo-Turkish War of 1877–1878 had its origins in a rise in nationalism in the Balkans as well as in the Russian goal of recovering territorial losses it had suffered during the Crimean War, reestablishing itself in the Black Sea and following the political movement attempting to free Balkan nations from the Ottoman Empire. As a result of the war, the principalities of Romania, Serbia and Montenegro, each of which had "de facto" sovereignty for some time, formally proclaimed independence from the Ottoman Empire. After almost half a millennium of Ottoman rule (1396–1878), the Bulgarian state was reestablished as the Principality of Bulgaria, covering the land between the Danube River and the Balkan Mountains (except Northern Dobrudja which was given to Romania) and the region of Sofia, which became the new state's capital. The Congress of Berlin also allowed Austria-Hungary to occupy Bosnia and Herzegovina and Great Britain to take over Cyprus, while the Russian Empire annexed Southern Bessarabia and the Kars region.