In the early 19th century, Finland and the remaining territories outside the Scandinavian Peninsula were lost. Sweden's last war was the Swedish–Norwegian War (1814). Sweden was victorious in this war, leading to the Danish king being forced to cede Norway to Sweden. Norway was then forced to enter into a personal union with Sweden that lasted until 1905. Since 1814, Sweden has been at peace, adopting a non-aligned foreign policy in peacetime and neutrality in wartime. During World War I, Sweden remained neutral, but let the Germans travel in the country. Post-war prosperity provided the foundations for the social welfare policies characteristic of modern Sweden. During World War II, Sweden once again remained neutral, avoiding the fate of occupied Norway.