After an unsuccessful pro-Bolshevik uprising in Saint Petersburg, Trotsky was arrested on 7 August 1917. He was released 40 days later in the aftermath of the failed counter-revolutionary uprising by Lavr Kornilov. After the Bolsheviks gained a majority in the Petrograd Soviet, Trotsky was elected chairman on . He sided with Lenin against Grigory Zinoviev and Lev Kamenev when the Bolshevik Central Committee discussed staging an armed uprising, and he led the efforts to overthrow the Provisional Government headed by Aleksandr Kerensky.