After centuries of German, Swedish, Polish-Lithuanian and Russian rule, which was mainly executed by the Baltic German aristocracy, the Republic of Latvia was established on 18 November 1918 when it broke away from the German Empire and declared independence in the aftermath of World War I. However, by the 1930s the country became increasingly autocratic after the coup in 1934 establishing an authoritarian regime under Kārlis Ulmanis. The country's de facto independence was interrupted at the outset of World War II, beginning with Latvia's forcible incorporation into the Soviet Union, followed by the invasion and occupation by Nazi Germany in 1941, and the re-occupation by the Soviets in 1944 to form the Latvian SSR for the next 45 years. As a result of extensive immigration during the Soviet occupation, ethnic Russians became the most prominent minority in the country, now constituting nearly a quarter of the population. The peaceful Singing Revolution started in 1987, and ended with the restoring of de facto independence on 21 August 1991. Since then, Latvia has been a democratic  unitary parliamentary republic.