Following the signing of Ribbentrop-Molotov agreement and invasion of Poland by the Soviet Union, vast territories in eastern Poland were annexed to the Ukrainian Soviet Socialist Republic. The new border was short-lived as Nazi Germany invaded the Soviet Union. In 1945 following the end of the war and the establishment of the Polish People's Republic a new border was formed between the Ukrainian SSR and Poland with Poland losing vast territories in Ukraine's favor, including the city of Lviv.