The Russo-Polish War of 1654-1667, also called the Russian Deluge or the Thirteen Years' War, was fought between the Tsardom of Russia and Poland-Lithuania amid "The Deluge," a period of foreign invasions in late 17th-century Poland.
Orthodox Ukrainians' resentment of Polish Catholicization efforts and the mistreatment of the Cossacks by Polish magnates resulted in the outbreak of the Khmelnytsky Uprising in 1648. Bohdan Khmelnytsky won the support of Tsar Alexis of Russia in exchange for his allegiance within the tsardom, and the Cossacks inflicted severe defeats on the Poles at the Battle of Zhovti Vody and the Battle of Korsun in May 1648 and the Battle of Pyliavtsi in September. The accession of John II Casimir Vasa to the Polish throne calmed the rebellious Cossacks, as he immediately began settling reforms in order to resolve political disputes and ethnic tensions. However, rising Ukrainian nationalism resulted in a breakdown of negotiations between King John II Casimir and Khmelnytsky, and, in 1654, Khmelnytsky signed the Pereiaslav Agreement with Moscow, accepting the Tsar's superiority in exchange for Ukrainian autonomy. In 1653, the Russian Duma authorized the creation of a protectorate in Ukraine, and, in 1654, Russia declared war on Poland.
In July 1654, a 41,000-strong Russian army under Princes Yakov Cherkassky, Nikita Odoevsky, and Ivan Khovansky besieged Smolensk and captured Orsha. The Poles fought the invading Russians to a draw at the Battle of Shklov on 12 August 1654, but the Lithuanian hetman Janusz Radziwiłł was defeated at the Battle of Shepeleviche and Smolensk fell to Russia on 23 September. Meanwhile, Prince Aleksey Trubetskoy led the southern flank of the Russian army from Bryansk to Ukraine, capturing Mstislavl, Roslavl, and Homel. In the north, Vasily Sheremetev captured Nevel, Polotsk, and Vitebsk. Russian troops then swarmed into Polish Livonia and captured Ludza and Rezenke, and combined Russian-Cossack forces invaded Volhynia and conquered Ostrog and Rowne by the end of the year.
In early 1655, Radziwill launched a counteroffensive in Belarus, recapturing Orsha and besieging Mogilev. The Poles defeated Sheremetev and Khmelnytsky at the Battle of Okhmativ in January 1655, while a second Russian-Ukrainian army was defeated at Zhashkov. The Tsar ordered a massive offensive into Lithuania in response to these defeats, and Minsk fell on 3 July, Vilnius on 31 July, and Kaunas and Hrodno in August. Elsewhere, Prince Fyodor Volkonsky sailed from Kyiv up the Dnieper and captured Pinsk. In September, the Russians attacked Lwow and entered Lublin after Pawel Jan Sapieha was defeated near Brest. Taking advantage of Poland's weakness, King Charles X Gustav of Sweden invaded Poland in 1655.
On 2 November 1655, Russian statesman Afanasy Ordin-Nashchokin signed an armistice with the Poles, allowing for Russia to focus on fighting the Second Northern War against Sweden. After Khmelnytsky's death in 1657, his successor Ivan Vyhovsky allied with the Poles, creating the Grand Duchy of Ruthenia in September 1658. The Cossacks soon fell into their own civil war, The Ruin, as the result of the treaty with Poland, and some Cossacks signed a new Treaty of Pereyaslav with Russia in 1659. In 1658, Russia made peace with Sweden (keeping several conquests in Livonia) and refocused on the war with Poland. The Tsar captured Wincenty Gosiewski at the Battle of Werki in October 1658, and the Poles failed to blockade Vilnius. The Cossack siege of Kiev was also defeated, and Vyhovsky swore an oath to the Russian tsar. In Belarus, the Ukrainian Cossacks staged a mutiny, and they joined forces with the Tatars to heavily defeat the Russians at the Battle of Konotop in 1659.
After Ataman Ivan Sirko attacked the Crimean Khanate, Vyhovsky lost his alliance with the Tatars, removing the threat to the Russians during their conquests in Ukraine. Sirko then led a full-scale uprising throughout Ukraine, demanding Vyhovsky's overthrow and the restoration of Khmelnytsky's son Yurii to the hetmanate. Khmelnystky emerged victorious and allied with the Russians.
In 1660, the tide of war turned in favor of the Poles after King John II Casimir made peace with Sweden. Sapieha and Stefan Czarniecki defeated the Russians at the Battle of Polonka on 27 June and forced Sheremetev to surrender after the Battle of Cudnow in November. In 1662, the Russians defeated Khmenlytsky's Polish-allied Cossacks at the Battle of Kaniv, but, in 1663, King Jan Casimir invaded left-bank Ukraine. The Polish siege of Hlukhiv in January 1663 was a costly failure and the campaign proved a fiasco, and the 1664 campaigns were a disappointment. In 1667, the outbreak of Jerzy Sebastian Lubomirski's rebellion forced the Poles to make peace with Russia.
The Treaty of Andrusovo ceded Smolensk and left-bank Ukraine (including Kiev) to Russia, while the Commonwealth retained right-bank Ukraine. The war forced Russia to gradually transform its seasonally mobilized army into a standing army. The war was a major negative outcome for Poland, as it was left greatly weakened and vulnerable to Russian incursions.