The Livonian War (1558–1583) was fought for control of Old Livonia (in the territory of present-day Estonia and Latvia), when the Tsardom of Russia faced a varying coalition of the Dano-Norwegian Realm, the Kingdom of Sweden, and the Union (later Commonwealth) of the Grand Duchy of Lithuania and the Kingdom of Poland.
During the period 1558–1578, Russia dominated the region with early military successes at Dorpat (Tartu) and Narva.
In 1576, Stephen Báthory became King of Poland as well as Grand Duke of Lithuania and turned the tide of the war with his successes between 1578 and 1581, including the joint Swedish–Polish–Lithuanian offensive at the Battle of Wenden. This was followed by an extended campaign through Russia culminating in the long and difficult siege of Pskov. Under the 1582 Truce of Jam Zapolski, which ended the war between Russia and Poland–Lithuania, Russia lost all its former holdings in Livonia and Polotsk to Poland–Lithuania. The following year, Sweden and Russia signed the Truce of Plussa with Sweden gaining most of Ingria and northern Livonia while retaining the Duchy of Estonia.