The Livonian War (1558–1583) was the Russian invasion of Old Livonia, and the prolonged series of military conflicts that followed, in which Tsar Ivan the Terrible of Russia (Muscovy) unsuccessfully fought for control of the region (present-day Estonia and Latvia). The Tsardom of Russia (Muscovy) 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. From 1558 to 1578, Russia controlled the greater part of the region with early military successes at Dorpat (Tartu) and Narwa (Narva). The dissolution of the Livonian Confederation brought Poland–Lithuania into the conflict, and Sweden and Denmark intervened between 1559 and 1561. Swedish Estonia was established despite continuing attacks from Russia, and Frederick II of Denmark bought the old Bishopric of Ösel–Wiek, which he placed under the control of his brother Magnus of Holstein. Magnus attempted to expand his Livonian holdings to establish the Russian vassal state, the Kingdom of Livonia, which nominally existed until his defection in 1576. 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. That 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 of 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. Prelude Pre-war Livonia By the mid-16th century, economically prosperous Old Livonia had become a region organised into the decentralised and religiously divided Livonian Confederation. Its territories consisted of the Livonian branch of the Teutonic Order, the prince-bishoprics of Dorpat (Tartu), Ösel–Wiek, as well as Courland, the Archbishopric of Riga and the city of Riga. Together with Riga, the cities of Dorpat (Tartu) and Reval (Tallinn), along with the knightly estates, enjoyed privileges enabling them to act almost independently. The only common institutions of the Livonian estates were the regularly held common assemblies known as Landtags. As well as a divided political administration, there were also persistent rivalries between the Archbishop of Riga and the Landmeister of the