After the Russian Revolution, in which the Bolsheviks took over parts of the collapsing Russian Empire in 1918, they faced enormous odds against the German Empire and eventually negotiated terms to pull out of World War I. They then went to war against both domestic and international enemies in the bitter civil war. They set up the Soviet Union in 1922 with Vladimir Lenin in charge. At first, it was treated as an unrecognized pariah state because of its repudiating of tsarist debts and threats to destroy capitalism at home and around the world. By 1922, Moscow had repudiated the goal of world revolution, and sought diplomatic recognition and friendly trade relations with the capitalist world, starting with Britain and Germany. Finally in 1933, the United States gave recognition. Trade and technical help from Germany and the United States arrived in the late 1920s. After Lenin died in 1924, Joseph Stalin, became leader. He transformed the country in the 1930s into an industrial and military power. It strongly opposed Nazi Germany until August 1939, when it suddenly came to friendly terms with Berlin in the Molotov–Ribbentrop Pact. Moscow and Berlin by agreement divided up Poland and the Baltic nations. Stalin ignored repeated warnings that Hitler planned to invade. He was caught by surprise in June 1941 when Nazi Germany invaded the Soviet Union. The Soviet forces nearly collapsed as the Germans reached the outskirts of Leningrad and Moscow. However, the Soviet Union proved strong enough to defeat Nazi Germany, with help from its key World War II allies, Britain and the United States. The Soviet army occupied most of Eastern Europe (except Yugoslavia) and increasingly controlled the governments. In 1945, the USSR became one of the five permanent members of the United Nations Security Council along with the United States, Britain, France, and China, giving it the right to veto any of the Security Council's resolutions (see Soviet Union and the United Nations). By 1947, American and European anger at Soviet control over Eastern Europe led to a Cold War, with Western Europe organized economically with large sums of Marshall Plan money from Washington. Opposition to the danger of Soviet expansion formed the basis of the NATO military alliance in 1949. There was no hot war, but the Cold War was fought diplomatically and politically across the world by the Soviet and NATO blocks. The Kremlin controlled the socialist states