The land area that now makes up Finland was settled immediately after the last ice age, which ended in 9000 BC. Most of the region was a part of the Kingdom of Sweden from the 13th century to 1809, when the vast majority of the Finnish-speaking areas of Sweden were ceded to the Russian Empire (excluding the Finnish-speaking areas of the modern-day Northern Sweden), making this area the autonomous Grand Duchy of Finland. The Lutheran religion dominated. Finnish nationalism emerged, focused on Finnish cultural traditions, including music and—especially—the highly distinctive language and lyrics associated with it. The catastrophic Finnish famine of 1866–1868 was followed by eased economic regulations and extensive emigration.
In 1917, Finland declared independence. A civil war between the Finnish Red Guards and the White Guard ensued a few months later, with the "Whites" gaining the upper hand during the springtime of 1918. After the internal affairs stabilized, the still mainly agrarian economy grew relatively fast. Relations with the West, especially Sweden and Britain, were strong but tensions remained with the Soviet Union. During the Second World War, Finland fought twice against the Soviet Union and defended its independence, though in the 1947 peace settlement, it ended up ceding a large part of Karelia and some other areas to the Soviet Union. However, Finland remained an independent democracy in North Europe.