On August 23, 1939–shortly before World War II (1939-45) broke out in Europe–enemies Nazi Germany and the Soviet Union surprised the world by signing the German-Soviet Nonaggression Pact, in which the two countries agreed to take no military action against each other for the next 10 years. With Europe on the brink of another major war, Soviet leader Joseph Stalin (1879-1953) viewed the pact as a way to keep his nation on peaceful terms with Germany, while giving him time to build up the Soviet military. The nonaggression pact contained a secret protocol that provided for the partition of Poland and the rest of eastern Europe into Soviet and German spheres of interest. In accordance with this plan, the Soviet army occupied and annexed eastern Poland in the autumn of 1939. On November 30, 1939, the Soviet Union attacked Finland, precipitating a four-month winter war after which the Soviet Union annexed Finnish territory borderlands, particularly near Leningrad. With German indulgence, the Soviet Union also moved to secure its sphere of interest in eastern Europe in the summer of 1940. The Soviets occupied and incorporated the Baltic states and seized the Romanian provinces of northern Bukovina and Bessarabia. After the Germans defeated France in June 1940, German diplomats worked to secure Germany's ties in southeastern Europe. Hungary, Romania, and Slovakia all joined the Axis alliance in November 1940. Hitler used the pact to make sure Germany was able to invade Poland unopposed. The pact also contained a secret agreement in which the Soviets and Germans agreed how they would later divide up Eastern Europe. The German-Soviet Nonaggression Pact fell apart in June 1941, when Nazi forces invaded the Soviet Union.