Greece achieved its independence from the Ottoman Empire in 1829. During the second half of the 19th century and the first half of the 20th century, it gradually added neighboring islands and territories, most with Greek-speaking populations. In World War II, Greece was first invaded by Italy (1940) and subsequently occupied by Germany (1941-44); fighting endured in a protracted civil war between royalist supporters of the king and communist rebels. Following the latter's defeat in 1949, Greece was able to join NATO in 1952. A military dictatorship, which in 1967 suspended many political liberties and forced the king to flee the country, lasted seven years. The 1974 democratic elections and a referendum created a parliamentary republic and abolished the monarchy. Greece joined the European Community or EC in 1981 (which became the EU in 1992); it became the 12th member of the euro zone in 2001.