stylistic:tone, information:highlighting
1918–1921: Military command

After the Bolsheviks seized power, both right and left-wing armies rallied against them, generating the Russian Civil War. In May 1918, amid a dwindling food supply, Sovnarkom sent Stalin to Tsaritsyn to take charge of food procurement in Southern Russia. Eager to prove himself as a commander, he took control of regional military operations. He also befriended two military figures, Kliment Voroshilov and Semyon Budyonny, who would form the nucleus of his support base. Stalin sent large numbers of Red Army troops into battle against the region's anti-Bolshevik White armies, resulting in heavy losses; Lenin was concerned by this costly tactic. In Tsaritsyn, Stalin commanded the local Cheka branch to execute suspected counter-revolutionaries, often without trial, and purged the military and food collection agencies of middle-class specialists, whom he also executed. His use of state violence was at a greater scale than most Bolshevik leaders approved of; for instance, he ordered several villages to be torched to ensure compliance with his food procurement program.

In December 1918, Stalin was sent to Perm to lead an inquiry into how Alexander Kolchak 's White forces had been able to decimate Red troops based there. He returned to Moscow between January and March 1919, before being assigned to the Western Front at Petrograd. When the Red Third Regiment defected, he ordered the public execution of captured defectors. In September, he returned to the Southern Front. During the war, he proved his worth to the Central Committee, displaying willingness to take on responsibility in conflict situations. At the same time, he disregarded orders and repeatedly threatened to resign when affronted. He was reprimanded by Lenin at the 8th Party Congress for employing tactics which resulted in the deaths of Red Army soldiers. In November 1919, the government nonetheless awarded him the Order of the Red Banner for his wartime service.

The Bolsheviks won the Russian Civil War by the end of 1919. By that time, Sovnarkom had turned its attention to spreading proletarian revolution abroad, forming the Communist International in March 1919; Stalin attended its inaugural ceremony. Although Stalin did not share Lenin's belief that Europe's proletariat were on the verge of revolution, he acknowledged that Soviet Russia remained vulnerable. In December 1918, he drew up decrees recognising Marxist-governed Soviet republics in Estonia, Lithuania, and Latvia; during the civil war these Marxist governments were overthrown and the Baltic countries became fully independent of Russia, an act Stalin regarded as illegitimate. In February 1920, he was appointed to head the Workers' and Peasants' Inspectorate; that same month he was also transferred to the Caucasian Front.

Following earlier clashes between Polish and Russian troops, the Polish–Soviet War broke out in early 1920, with the Poles invading Ukraine and taking Kiev on 7 May. On 26 May, Stalin was moved to Ukraine. The Red Army retook Kiev on 10 June and soon forced the troops back into Poland. On 16 July, the Central Committee decided to take the war into Polish territory. Lenin believed that the Polish proletariat would rise up to support the Russians against Józef Piłsudski 's Polish government. Stalin had cautioned against this, believing that nationalism would lead the Polish working-classes to support their government's war effort. He also believed that the Red Army was ill-prepared to conduct an offensive war. Stalin lost the argument, after which he accepted Lenin's decision. Along the Southwest Front, he became determined to conquer Lvov; in focusing on this goal, he disobeyed orders in early August to transfer his troops to assist Mikhail Tukhachevsky 's forces that were attacking Warsaw.

In mid-August 1920, the Poles repulsed the Russian advance, and Stalin returned to Moscow to attend the Politburo meeting. Mikhail Tukhachevsky blamed Stalin for his defeat at the Battle of Warsaw. In Moscow, Lenin and Trotsky also blamed him for his behaviour in the Polish–Soviet War. Stalin felt humiliated; on 17 August, he demanded demission from the military, which was granted on 1 September. At the 9th Bolshevik Conference in late September, Trotsky accused Stalin of "strategic mistakes". Trotsky claimed that Stalin sabotaged the campaign by disobeying troop transfer orders. Lenin joined Trotsky in criticising him. Stalin felt disgraced and his antipathy toward Trotsky increased. The Polish–Soviet War ended on 18 March 1921, when a peace treaty was signed in Riga.