In 1576, Stephen Báthory became King of Poland as well as Grand Duke of Lithuania. He 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.