Trotsky became (Nov., 1917) people's commissar for foreign affairs under Lenin. He was a principal figure in negotiations for a separate peace between Russia and the central powers. In the Treaty of Brest-Litovsk (Feb., 1918) Russia submitted to such humiliating conditions that Trotsky was compelled to resign as commissar for foreign affairs. He became commissar of war in 1918 and organized the Red Army in the civil war that followed the revolution, accomplishing the monumental task of welding an efficient fighting force from the tattered remnants of the czarist army and various disparate elements.
It was during the civil war that enmity grew between Trotsky and Joseph Stalin. In the trade-union debate (1920–21) within the party, Trotsky clashed with Lenin by demanding strict state control of unions. But the two leaders were again drawn together as a result of the anti-Bolshevik Kronstadt Revolt (1921), the military suppression of which Trotsky directed. As Lenin's health declined, Stalin, more skillful in party infighting, gained prominence. As a result of the tenth party congress (1921), at which the trade-union issues were debated, Stalin was named (1922) general secretary of the party.
On Lenin's death (1924) titular power passed to a triumvirate consisting of Stalin, Lev Kamenev (Trotsky's brother-in-law), and Grigori Zinoviev. Advocating world revolution, Trotsky came into increasing conflict with Stalin's plans for "socialism in one country." Trotsky enjoyed great prestige as a revolutionary leader and had followers in the army and state administration, but Stalin effectively controlled the party machine. The triumvirate, although shaky, firmly opposed Trotsky.
Stalin refused to expel Trotsky from the party at this time, but he was dismissed as commissar of war in 1925. In 1926 Zinoviev and Kamenev belatedly joined forces with Trotsky in a desperate attempt to check Stalin's power. Trotsky was expelled from the politburo in 1926 and from the party in 1927.