On August 25, 1920, the Battle of Warsaw concluded in an conclusive Polish victory against the Soviet armies which faced the Polish troops. Soon after, Soviet leaders in the Soviet states involved agreed to terms to end the war as their militaries had been routed in the aftermath of the battle. The Polish-Soviet War, which had begun in 1919, was formally ended with the Peace of Riga on March 18, 1921. While Polish territory had been expanded with territory ceded by the Soviet states, political machinations within Poland resulted in less territory than had been captured being retained due to an unwillingness to sustain military operations by the party in charge of the Polish parliament. Ukrainian forces which had been allied to the Second Polish Republic were left on their own and were either hunted down by Soviet forces or fled to Poland. Ethnic Poles who remained in Soviet-controlled territories also faced persecution which included mass executions in the Polish Operation of the NKVD during 1937-38 However, the conclusion of the battle and of the war also hindered, if not outright halted, Soviet/Communist expansion westward.
The Second Polish Republic met its end in 1939 following the joint Soviet and Nazi invasion of Poland, forcing the Polish government into exile. At the of the Second World War, Poland was left in the control of the USSR as a result of agreements reached by the US, UK, and USSR during the war. Poland would not regain its independence until the dying days of the Warsaw Pact. The Third Polish Republic, the current state of Poland, came to be in 1989 and joined NATO (North Atlantic Treaty Organization) in 1999 and the EU (European Union) in 2004.