By the early 20th century, Bulgaria, Greece, Montenegro and Serbia had achieved independence from the Ottoman Empire, but large parts of their ethnic populations remained under Ottoman rule. In 1912, these countries formed the Balkan League. The First Balkan War broke out when the League attacked the Ottoman Empire on 8 October 1912 and was ended seven months later by the Treaty of London. After five centuries, the Ottoman Empire lost virtually all of its possessions in the Balkans.
The Second Balkan War broke out on 16 June 1913. Bulgaria was dissatisfied over the division of the spoils in Macedonia, made in secret by its former allies, Serbia and Greece, and attacked them. The Serbian and Greek armies repulsed the Bulgarian offensive and counter-attacked into Bulgaria, while Romania and the Ottoman Empire also attacked Bulgaria and gained (or regained) territory. In the resulting Treaty of Bucharest, Bulgaria lost most of the territories it had gained in the First Balkan War.