Following the failure of the June Offensive morale in the army fell rapidly. Increasing numbers of soldiers deserted. Others lost their loyalty to the government.
Shortages continued and there was widespread unrest in Petrograd between the 3rd and 6th of July. Sailors from Kronstadt protested in the city. Soldiers joined them. Soon thousands of protesters awaited instructions from the Petrograd Soviet and the Bolsheviks.
However, there was little in the form of direction from Socialist Revolutionaries. Lenin did not take advantage of the situation, perhaps because only small numbers of soldiers and sailors actively supported the Bolsheviks.
The uprising was suppressed by loyal troops who were brought in by the Provisional Government. A number of Bolshevik leaders, including Trotsky, were arrested. Lenin fled to Finland.
In August 1917, Lavr Kornilova, a Russian General, made an attempt to seize power for himself. His army advanced on Petrograd. The Provisional Government, now under the leadership of Alexander Kerensky, seemed powerless to stop him. Kerensky called on the Petrograd Soviet to defend the city. This meant arming the Soviet - a move that would not be easy to reverse.
Under Trotsky's direction, the Red Guards organised the defence of the city. Bolshevik agents infiltrated Kornilov's troops and encouraged them to desert. The Bolsheviks also organised strikes by railway workers - disrupting Kornilov's supplies and communications. By the end of the month, Kornilov had been relieved of his command and put under arrest.
An important result of the Kornilov Revolt was a marked increase in support for the Bolsheviks. They were seen to have saved the revolution from a loyal Tsarist general. By September, the Bolsheviks had gained control of the Petrograd Soviet.