The Battles of Wenden were a series of battles for control of the stronghold of Wenden (Cēsis, Kiesia, Võnnu), in present-day Latvia, fought during the Livonian War in 1577 and 1578. Magnus of Livonia besieged the town in August 1577, but was deposed and replaced by Russian forces under Tsar Ivan IV, who eventually sacked the town and castle in what became a symbolic victory. Polish forces, however, re-captured the stronghold in November and beat back a Russian counter-attack in February 1578.
In October 1578, the Russian army again laid siege to the town, but was destroyed by a smaller Swedish–German–Polish relief force. This marked the turning point in the Livonian War, shifting the initiative from the Tsardom of Russia to Sweden and the Polish–Lithuanian Commonwealth. It also marked the end of the Kingdom of Livonia, which collapsed when Magnus retired to Courland.

Background
In 1570 and 1571, Ivan IV "the Terrible" of Russia faced internal disputes, culminating in the slaughter of Novgorod's inhabitants and the burning of Moscow by the Crimean tartars. Yet, he was able to recover and resume his campaigns in the Livonian War in 1572. A Swedish counter-offensive in 1574 failed. Ivan IV had introduced a new strategy, relying on tens of thousands of his troops, Cossacks, and tartars to achieve superiority over his adversaries. Unlike the latter, he used a large number of native troops instead of a few thousand professional mercenaries. Swedish forces were besieged in Reval (Tallinn), Danish Estonia was raided, and so was central Livonia as far as Dünaburg (Daugavpils), since 1561 formally under Polish-Lithuanian suzerainty. The conquered territories submitted to Ivan or his vassal, Duke Magnus of the House of Oldenburg, who was declared as king of Livonia in 1570.

The year 1576 marked the height of Ivan's campaign, and another 30,000 Russian forces crossed into Livonia in 1577. Magnus had fallen into disgrace when he defected from Ivan IV during the same year, and started to subordinate castles without consulting the tsar. When Kokenhusen (Koknese) submitted to Magnus in the hope of avoiding Ivan IV's army, the tsar sacked it and executed its German commanders. The campaign then focussed on Wenden (Cēsis, Võnnu), "the heart of Livonia", which as the former capital of the Livonian Order was not only of strategic importance but also a symbol for Livonia itself.

1577
In the summer of 1577, Magnus of Livonia laid siege to Wenden. The Russian army under Ivan IV appeared before Wenden's walls in late August. Ivan had Magnus arrested, sacked the town, and laid siege to the castle. The last 300 defenders, men, women, and children retreated to the castle's main tower and either died in an accidental explosion of gunpowder stored in the tower or committed collective suicide by blowing themselves up with of gunpowder, probably because the garrison had been "promised a terrible fate" by the tsar in response to them having fired at him with cannons. Thus, Wenden fell to Ivan in September, and was made a seat of four newly appointed voivodes who were to administer the province for Russia.
The sack of Wenden was a huge symbolic victory for Ivan. Among his opponents in the Livonian War, John III of Sweden only controlled Reval (Tallinn), Stephen Báthory of Poland only held Riga, Frederick II of Denmark was limited to the island of Øsel (Ösel, Saaremaa), Magnus of Livonia, though released by Ivan, abdicated in 1578 and withdrew to Piltene in Courland. Ivan's control of nearly all of Livonia and Estonia was secured by garrisons numbering 22,000 men in total.
1578
John III and Stephen Báthory formed an alliance against Ivan IV in December 1577, after Báthory had concluded the Danzig War. Already in November, Lithuanian forces had started an offensive from the south and captured Dünaburg (Daugavpils). A Polish–Swedish force took the town and castle of Wenden in early 1578. Russian forces tried to re-take the town in February, but failed.
A subsequent Swedish offensive, targeted Leal (Lihula), Lode (Koluvere), Hapsal (Haapsalu), Pernau (Pärnu), Dorpat (Tartu), and Novgorod. In September, Ivan responded by sending in an army, which the Livonian Chronicle claimed to be 18,000 strong, who re-captured Oberpahlen (Põltsamaa) from Sweden and then marched on Wenden.





