By the peace of Zapoli (January 15th, 1582) he surrendered Livonia with Polotsk to Bathory, and by the truce of Ilyusa he at the same time abandoned Ingria to the Swedes.
During a halt of a few days in Poland on his way back from Vienna, King Augustus had explained to him a project for partitioning the transBaltic provinces of Sweden, by which Poland should recover Livonia and annex Esthonia, Russia should obtain Ingria and Karelia, and Denmark should take possession of Holstein.
By that treaty Peter acquired not only Ingria and Karelia, as originally contemplated, but also Livonia, Esthonia and part of Finland.
From 1709 to 1714 he served during the Courland, Holstein and Pomeranian campaigns, but then, as governor-general of Ingria, 'with almost unlimited powers, was entrusted with a leading part in the civil administration.
Charles's "immersion in the Polish bog" (1702-1707), as Peter phrased it, enabled the tsar, not without considerable expense and trouble, to conquer Ingria and lay the foundations of St Petersburg.