On 13 November 1918, after the collapse of the Central Powers and the Armistice of 11 November 1918, Vladimir Lenin's Russia annulled the Treaty of Brest-Litovsk and started moving forces in the western direction to recover and secure the Ober Ost regions vacated by the German forces that the Russian state had lost under the treaty. Lenin saw the newly independent Poland (formed in October–November 1918) as the bridge which his Red Army would have to cross to assist other communist movements and to bring about more European revolutions. At the same time, leading Polish politicians of different orientations pursued the general expectation of restoring the country's pre-1772 borders. Motivated by that idea, Polish Chief of State Józef Piłsudski began moving troops east.
In 1919, while the Soviet Red Army was still preoccupied with the Russian Civil War of 1917–1922, the Polish Army took most of Lithuania and Belarus. By July 1919, Polish forces had taken control of much of Western Ukraine and had emerged victorious from the Polish–Ukrainian War of November 1918 to July 1919. In the eastern part of Ukraine bordering on Russia, Symon Petliura tried to defend the Ukrainian People's Republic, but as the Bolsheviks gained the upper hand in the Russian Civil War, they advanced westward towards the disputed Ukrainian lands and made Petliura's forces retreat. Reduced to a small amount of territory in the west, Petliura was compelled to seek an alliance with Piłsudski, officially concluded in April 1920.
Piłsudski believed that the best way for Poland to secure favorable borders was by military action and that he could easily defeat the Red Army forces. His Kiev Offensive commenced in late April 1920 and resulted in the takeover of Kiev by the Polish and allied Ukrainian forces on 7 May. The Soviet armies in the area, which were weaker, had not been defeated, as they avoided major confrontations and withdrew.
The Red Army responded to the Polish offensive with counterattacks: from 5 June on the southern Ukrainian front and from 4 July on the northern front. The Soviet operation pushed the Polish forces back westward all the way to Warsaw, the Polish capital, while the Directorate of Ukraine fled to Western Europe. Fears of Soviet troops arriving at the German borders increased the interest and involvement of the Western powers in the war. In mid-summer the fall of Warsaw seemed certain but in mid-August the tide had turned again after the Polish forces achieved an unexpected and decisive victory at the Battle of Warsaw (12 to 25 August 1920). In the wake of the eastward Polish advance that followed, the Soviets sued for peace, and the war ended with a ceasefire on 18 October 1920. The Peace of Riga, signed on 18 March 1921, divided the disputed territories between Poland and Soviet Russia. The war and the treaty negotiations determined the Soviet–Polish border for the rest of the interwar period.