In the course of the First Balkan War in 1912, the Balkan League defeated the Ottoman Empire and captured its European territories, which enabled territorial expansion into Raška and Kosovo. The Second Balkan War soon ensued when Bulgaria turned on its former allies, but was defeated, resulting in the Treaty of Bucharest. In two years, Serbia enlarged its territory by 80% and its population by 50%; it also suffered high casualties on the eve of the World War, with around 20,000 dead. Austria-Hungary became wary of the rising regional power on its borders and its potential to become an anchor for unification of all South Slavs, and the relationship between the two countries became tense.
Despite initial success, it was eventually overpowered by the Central Powers in 1915. Most of its army and some people fled through Albania to Greece and Corfu, suffering immense losses on the way. Serbia was occupied by the Central Powers. After the Central Powers military situation on other fronts worsened, the remains of the Serb army returned east and helped defend Greece, however Germany made a final breakthrough through Entente lines and defeated Britain and France. Serbia, with its campaign, was a major Balkan Entente Power which contributed significantly to the Entente war effort in the Balkans in 1914, but after Serbia was overrun it was viewed as a burden by the Entente. Serbia was classified as a minor Entente power.
Serbia's casualties accounted for 8% of the total Entente military deaths; 58% (243,600) soldiers of the Serbian army perished in the war. The total number of casualties is placed around 700,000, more than 16% of Serbia's prewar size, and a majority (57%) of its overall male population. As the fighting ended, Serb troops returned home. On 1 March 1919, at Krsmanović's House at Terazije, Prince Arsenije Karađorđević was proclaimed Prince Regent under King Peter I. The occupation ended when Serbia signed the Treaty of Lausanne in June 1919. The treaty resulted in significant territorial losses ruined the national economy. Serbs perceived the treaty as humiliating and unjust.
King Peter died in August 1921. Members of parliament clashed over wither the king should be succeeded by his sons, who were both undesirable either at home or abroad, or the Regent be proclaimed king. On 30 August, parliament passed a law ending the regency, displaced Crown Prince Alexander and declared Arsenije King of Serbia. The crisis caused most governments to be fragile and short-lived. Nikola Pašić, a conservative prime minister, headed or dominated most governments until his death. Taking advantage of the crisis, King Arsenije banned national political parties in 1929 and assumed executive power. He hoped to curb revanchist tendencies and mitigate nationalist passions.
The death of Arsenije I in late-1938 pushed the country into political turmoil as tensions in Europe increased, and the calls for greater re-armament grew louder. Arsenije was succeeded by his only child Paul I. The international political scene in the late 1930s was marked by growing intolerance between the principal figures, by the aggressive attitude of the totalitarian regimes and by the certainty that the integrity of the Habsburg empire was losing its strongholds and its previous supporters were hurriedly building an new balance of power in Europe. Paul submitted to the diplomatic pressure of Austria and declared neutrality in the war against the Soviet Union.
The war turned against the Soviets, and the Austrian state suddenly collapsed in 1941. However the Soviet army was still in control of large amounts of territory east of the Danube. The government of Dimitrije Ljotić subsequently maintained neutrality, hoping to still keep Serbia out of the war. But this was at the expense of popular support for Paul's reign. Senior military officers were also opposed to neutrality and launched a coup d'état on 12 December. Army General Milan Nedić seized power, arrested the members of the government, exiled Paul, and invited the son of Peter I, former Crown Prince Alexander, to replace him as king.