Under Stalin's rule, the concept of "socialism in one country" became a central tenet of Soviet society. He replaced the New Economic Policy introduced by Lenin in the early 1920s with a highly centralised command economy, launching a period of industrialization and collectivization that resulted in the rapid transformation of the USSR from an agrarian society into an industrial power. However, the economic changes coincided with the imprisonment of millions of people in correctional labour camps. The initial upheaval in agriculture disrupted food production and contributed to the catastrophic Soviet famine of 1932–1933, known as the Holodomor in Ukraine. Altogether Stalin's economic and political policies resulted in the deaths of up to 10 million peasants during 1926-1934. Between 1934 and 1939 he organized and led a massive purge (known as "Great Purge") of the party, government, armed forces and intelligentsia, in which millions of so-called "enemies of the Soviet people" were imprisoned, exiled or executed, in a period that lasted from 1936 to 1939, Stalin instituted a campaign against alleged enemies within his regime Major figures in the Communist Party, such as the old Bolsheviks, Leon Trotsky, and most of the Red Army generals, were killed after being convicted of plotting to overthrow the government and Stalin.
In August 1939, Stalin entered into a non-aggression pact with Nazi Germany that divided their influence and territory within Eastern Europe, resulting in their invasion of Poland in September of that year, but Germany later violated the agreement and launched a massive invasion of the Soviet Union in June 1941. Despite heavy human and territorial losses, Soviet forces managed to halt the Nazi incursion after the decisive Battles of Moscow and Stalingrad. After defeating the Axis powers on the Eastern Front, the Red Army captured Berlin in May 1945, effectively ending the war in Europe for the Allies. The Soviet Union subsequently emerged as one of two recognized world superpowers, the other being the United States. The Yalta and Potsdam conferences established communist governments loyal to the Soviet Union in the Eastern Bloc countries as buffer states, which Stalin deemed necessary in case of another invasion. He also fostered close relations with Mao Zedong in China and Kim Il-sung in North Korea.
Stalin led the Soviet Union through its post-war reconstruction phase, which saw a significant rise in tension with the Western world that would later be known as the Cold War. During this period, the USSR became the second country in the world to successfully develop a nuclear weapon, as well as launching the Great Plan for the Transformation of Nature in response to another widespread famine and the Great Construction Projects of Communism. In the years following his death, Stalin and his regime have been condemned on numerous occasions, most notably in 1956 when his successor Nikita Khrushchev denounced his legacy and initiated a process of de-Stalinization. He remains a controversial figure today, with many regarding him as a tyrant. However, popular opinion within the Russian Federation is mixed.