The Livonian War (1558-1583) was a major war fought between the Tsardom of Russia and an alliance of the Livonian Order, Poland-Lithuania, Denmark-Norway, and Sweden for control of Livonia in the Baltics.
In 1558, Tsar Ivan the Terrible of Russia invaded Livonia after it reneged on a promise made in 1554 by allying with Poland-Lithuania. The Russians were welcomed by the Baltic peasants as liberators from the German control of Livonia, and many fortresses surrendered without resistance. However, the Livonians - aided by 1,200 northern German landsknecht mercenaries and 100 gunners - retook Wesenberg (Rakvere) and several other fortresses. From 1559 to 1560, the Russians launched another invasion of Livonia with aid from the Central Asian Qasim Khanate. In June 1559, Poland-Lithuania agreed to join the war to protect its Livonian allies. The Russians had succeeded in taking the fortress of Fellin, but were unable to take Riga, Reval, or Parnu; in August 1560, they defeated the Livonian Knights at the Battle of Ergeme. In 1561, the weakened Livonian Order dissolved and was replaced by the secularized Duchy of Livonia and assigned to the Grand Duchy of Lithuania. The Livonian leader Gotthard Kettler then converted to Lutheranism and became the leader of the Duchy of Courland and Semigallia. Some Lithuanian nobles opposed the growing power of Poland-Lithuania and offered the crown of Livonia to Ivan, who instead conferred the Kingdom of Livonia on the Danish nobleman Magnus of Holstein years later. In 1561, however, Sweden joined the war, and Reval accepted Swedish rule, leading to the formation of the Duchy of Estonia. This precipitated the Northern Seven Years' War between Sweden and the allied Danes and Poles, as the Danes claimed Estonia for themselves, having previously sold Danish Estonia to the Teutonic Order in 1346. From 1562 to 1570, the Livonian War consisted only of sporadic fighting, as Denmark and Russia made peace in 1562, followed by Sweden and Russia in 1564. However, Russia fell into a state of civil war in 1565 when Ivan turned against the powerful oprichniki. His invasions of Lithuania were defeated in 1564 and 1567, and, in 1569, Poland and Lithuania formally united into a commonwealth; the Duchy of Livonia came under Polish-Lithuanian joint sovereignty. In 1570, Russia made peace with Poland-Lithuania, only for Ivan to then go to war with Sweden for control of Estonia. Reval held out against the Russians in 1570 and 1571, and the Russians raided into Finland and attacked Helsinki in 1572. By 1573, the desperate King John III of Sweden owed 200,000 daler to his German mercenaries, and, when he was unable to pay them, he was forced to sell Hapsal, Leal, and Lode to Denmark.
The war began to turn against Russia, however, due to economic crisis and famine. The Crimean Khanate devastated Russia and burned and looted Moscow, and drought and epidemics weakened the Russian war effort. The Tatars were defeated in 1562, and Ivan sent another 30,000 Russian troops to invade Livonia in 1577. This army forced the Danes out of Livonia, and King Frederick decided to end Danish involvement in the war. At the same time, the new Polish king Stephen Bathory secured Prussian aid in the war against Russia and recruited Polish, Hungarian, Bohemian, German, and Wallachian mercenaries. In 1577, Sweden and Poland-Lithuania allied against Russia, and the Lithuanians took Dunaburg and Wenden by early 1578. At the Battle of Wenden, the Poles and Swedes defeated the Russians and inflicted Ivan's first serious defeat in Livonia. Bathory then accelerated the formation of the hussars and gathered 56,000 troops (30,000 of them Lithuanians) and took Polotsk on 30 August 1579. Velikiye Luki fell on 5 September 1580, and, with Pskov under siege, Ivan signed a peace treaty with the Poles, unaware that the Polish invasion had lost momentum and was failing. In 1581, the Swedes took Narva, Ivangorod, Jama, and Koporye, conquering Livonia. Russia and Poland made peace in 1582, and, in 1583, Russia made peace with Sweden. Russia gave Ingria and Estonia to Sweden, while the Poles gained Livonia and Courland and the Danes gained the island of Osel (Saaremaa).