Under Swedish rule 1187-1809, Finland became a grand duchy with the Russian tsar as grand duke in 1809. In 1899, Finland was incorporated into the Russian Empire, but in July 1917, the Finnish Diet proclaimed independence. After several years of warfare, Russia accepted Finnish independence in 1919. In 1939, Finland was invaded by the Soviet Union and, in 1940, was compelled to cede extensive eastern territories to the Soviets. Finland subsequently allied itself with Germany in an attempt to regain these lands, but its defeat cost even further concessions. Although economically and culturally oriented toward the West, after World War II Finland pursued a policy of acquiescence to the Soviet Union. Since the breakup of the Soviet Union, Finland has strengthened its ties with the West, and in 1995 joined the European Union.