The origins of the Montenegrin state can be traced to the emergence of Duklja, a vassal state of Byzantium, in the 9th century. In 1042, King Vojislav won a decisive battle against Byzantium, and Duklja became independent. About 120 years later, Duklja (by then known as Zeta) was conquered by Raska (Serbia). The use of the name Montenegro began in the 15th century when the Crnojevi dynasty began to rule the principality of Zeta. Over the subsequent centuries, Montenegro, while a part of the Ottoman Empire, maintained a level of self-autonomy. From the 16th to 19th centuries Montenegro was a theocracy ruled by a series of bishop princes, who were at first selected by popular assembly but later through heredity. In 1852, it was transformed into a secular principality when Danilo Petrovic Njegos set aside the ecclesiastical title and assumed the title of prince. Montenegro was recognized as an independent, sovereign principality by the great powers of Europe assembled at the Congress of Berlin in July 1878.