The Kingdom of Serbia (Serbian: Краљевина Србија / Kraljevina Srbija), often rendered Servia in English at the time of its existence, was created when Prince Milan Obrenović, ruler of the Principality of Serbia, was crowned king in 1882. The Principality of Serbia was ruled by the Obrenović dynasty from 1817 onwards (at times replaced by the Karađorđević dynasty). The Principality, suzerain to the Porte, had expelled all Ottoman troops by 1867, de facto securing its independence. The Congress of Berlin in 1878 recognized the formal independence of the Principality of Serbia.
In 1918, Serbia joined with the State of Slovenes, Croats and Serbs to form the Kingdom of Serbs, Croats and Slovenes (later known as Yugoslavia) under the rule of the Karađorđević dynasty.