Treaty of Nystad
Sweden's defeat in the Great Northern War in 1721 resulted the Treaty of Nystad, the Russian Empire gained Sweden's Baltic territories Estonia (nowadays northern Estonia) and Livonia, (nowadays southern Estonia and northern Latvia). The legal system, Lutheran church, local and town governments, and education remained mostly German until the late 19th century and partially until 1918.