During the 10th and 12th centuries, the Bulgars ruled much of the Balkan peninsula but subsequently declined in power, falling under Turkish control in 1396. In 1878, Bulgaria became an autonomous principality under nominal Turkish rule. In fact, Bulgaria was independent — more closely aligned with Russia than with Turkey — and this independence was formalized in 1908. The Treaty of San Stefano (1878) established a "Greater Bulgaria," which included all Bulgars and encompassed territory that now forms parts of Macedonia, Greece, Romania and Turkey. The powers, fearing the expansion of Russian influence in the Balkans through such a large client-state, overturned that treaty at the Congress of Berlin later in the year. Bulgaria's foreign policy from 1878 through 1944 was based on the creation of this Greater Bulgaria. In 1885, Bulgaria absorbed Eastern Rumelia, and in the Balkan Wars (1912-13) further expanded its borders. Its defeat by the Allies in World War I cost Bulgaria its Aegean coastline, and its defeat in World War II brought the overthrow of the monarchy and the establishment of a communist regime. In 1990 the Bulgarian Parliament ended the monopoly of the Communist Party on political power in the country, and the communist leadership was replaced by democratic opponents. Bulgaria's economy is going through a wrenching transition, as the country works to overcome years of neglect, to modernize and integrate with the rest of Europe.