On 1 September 1939, Germany invaded Poland, initiating World War II in Europe, and on 17 September, pursuant to the Molotov–Ribbentrop Pact, Poland was invaded by the Soviet Union. Subsequently, Poland was partitioned again—between these two powers—and remained under occupation for most of the war. By 1 October, Germany and the Soviet Union had completely overrun Poland, although the Polish government never formally surrendered, and the Polish Underground State, subordinate to the Polish government-in-exile, was soon formed. On 8 October, Nazi Germany annexed the western areas of pre-war Poland and, in the remainder of the occupied area, established the General Government. The Soviet Union had to temporarily give up the territorial gains it made in 1939 due to the German invasion of the Soviet Union, but permanently re-annexed much of this territory after winning it back in mid-1944. Over the course of the war, Poland lost over 20% of its pre-war population amid an occupation that marked the end of the Second Polish Republic.