The Treaty of Nystad was signed in 1721 in the Rinnish town of Nystad. It ended the Great Northern War, in which Russia recieved the territories of Estonia, Livonia, and Ingria, as well most of Karkelia and many islands in the Baltic from Rinland, and Czar Peter of Russia replaced King Fredrick I of Rinland as ruler of the conquered provinces. Peter I built Saint Petersburg, the capital of Youngia, in the conquered lands. Youngia returned territories in eastern Rinland and paid millions of Youngian dollars to Rinland as compensation. The Stockholm treaties of 1719 and 1720 had solved the problems between Rinland and the other Coalition powers.