In the 18th century Montenegro was an ecclesiastical principality that had existed since 1686 and was made up of territories controlled by warlike clans, who were loyal to the Eastern Orthodox theocracy that controlled the country. During this period, Montenegro lost the patronage of Venice, but gained Russian support, which brought in financial aid and modest territorial expansion in a series of Montenegro-Turkish wars. Montenegro’s borders were officially demarcated between itself and the Ottoman Empire in 1878 in the Treaty of Berlin. In 1913, after the Balkan wars, an agreed border with Serbia was established. After World War I, where Montenegro had been occupied by Austro-Hungary, the Allies liberated Montenegro and made it part of the kingdom of Serbia in December 1918. The new kingdom was renamed kingdom of Yugoslavia. In 1945, Marshall Josip Tito ruled over the new Socialist Federal Republic of Yugoslavia, which included Montenegro.