In 1721 the Treaty of Nystad ended the Great Northern War. Russia acquired Ingria, Estonia, Livonia, and a substantial portion of Karelia. In turn, Russia paid two million Riksdaler and surrendered most of Finland. The Tsar retained some Finnish lands close to Saint Petersburg, which he had made his capital in 1712.