The capitulation of Estonia and Livonia in 1710 and the Treaty of Nystad, ending the Great Northern War in 1721, gave Vidzeme to Russia (it became part of the Riga Governorate). The Latgale region remained part of the Polish–Lithuanian Commonwealth as Inflanty Voivodeship until 1772, when it was incorporated into Russia. The Duchy of Courland and Semigallia became an autonomous Russian province (the Courland Governorate) in 1795, bringing all of what is now Latvia into the Russian Empire. All three Baltic provinces preserved local laws, German as the local official language and their own parliament, the Landtag.