The Polish–Muscovite War (1605–1618) took place in the early seventeenth century as a sequence of military conflicts and eastward invasions carried out by the Polish–Lithuanian Commonwealth, or the private armies and mercenaries led by the magnates (the Commonwealth aristocracy), when the Russian Tsardom was torn by a series of civil wars, the time most commonly referred to in the Russian history as the "Time of Troubles", sparked by the Russian dynastic crisis and overall internal chaos. The sides and their goals changed several times during this conflict: the Polish–Lithuanian Commonwealth was not formally at war with Russia until 1609, and various Russian factions fought amongst themselves, allied with the Commonwealth and other countries or fighting against them. Sweden also participated in the conflict during the course of the Ingrian War (1610–1617), sometimes allying itself with Russia, and other times fighting against it. The aims of the various factions changed frequently as well as the scale of the parties' goals, which ranged from minor border adjustments to imposing the Polish Kings or the Polish-backed impostors' claims to the Russian throne and even the creation of a new state by forming a union between the commonwealth and Russia.
The war can be divided into four stages. In the first stage, certain commonwealth szlachta (nobility), encouraged by some Russian boyars (Russian aristocracy), but without the official consent of the Polish king Sigismund III Vasa, attempted to exploit Russia's weakness and intervene in its civil war by supporting the impostors for the tsardom, False Dmitriy I and later False Dmitriy II, against the crowned tsars, Boris Godunov and Vasili Shuiski. The first wave of the Polish intervention began in 1605 and ended in 1606 with the death of False Dmitri I. The second wave started in 1607 and lasted until 1609, when Tsar Vasili made a military alliance with Sweden. In response to this alliance, the Polish king Sigismund III decided to intervene officially and to declare war upon Russia, aiming to weaken Sweden's ally and to gain territorial concessions.
After early commonwealth victories (Battle of Klushino), which culminated in Polish forces entering Moscow in 1610, Sigismund's son, Prince Wladislaus, was briefly elected tsar. However, soon afterwards, Sigismund decided to seize the Russian throne for himself. This alienated the pro-Polish supporters among the boyars, who could accept the moderate Wladislaus, but not the pro-Catholic and anti-Orthodox Sigismund. Subsequently, the pro-Polish Russian faction disappeared, and the war resumed in 1611, with the Poles being ousted from Moscow in 1612 but capturing the important city of Smolensk (see Siege of Smolensk (1609–1611)). However, due to internal troubles in both the Commonwealth and Russia, little military action occurred between 1612 and 1617, when Sigismund made one final and failed attempt to conquer Russia. The war finally ended in 1618 with the Truce of Deulino, which granted the Commonwealth certain territorial concessions, but not control over Russia which thus emerged from the war with its independence unscathed.