The Bulgars and local Slavs merged in the 7th century to form the first Bulgarian state. After struggling for dominance with the Byzantine Empire for centuries, Bulgaria fell under Ottoman Turkish rule by the 14th century. Northern Bulgaria gained autonomy in 1878 and full independence in 1908. Bulgaria was subsequently influenced by the Soviet Union after World War 2 but transitioned to democracy in the 1990s. It joined NATO and the EU in 2004 and 2007, respectively.