The Twelfth Army was then tasked with defending Riga, though the situation on the northern frontier of the Eastern Front remained static until early 1917.
Having anticipated the German attack, the Russian high command and General Klembovsky gave the order to abandon the bridgehead on the opposite side of the Dvina river near Riga on 20 August 1917.
The German Eighth Army began its attack on 1 September, crossing the Dvina river south of the fortified Russian positions around the city.
It was then split into two forces, with one attacking a nearby Russian corps that was threatening the bridgehead while another advanced north along the river towards Riga.
But the fighting in the south and the march to Riga bought enough time for most of the Russian Twelfth Army to retreat from the city intact.
The German Tenth Army under Paul von Hindenburg initially wanted to break through the Vilnius–Kaunas gap to then turn from the north and capture Minsk, a major Russian communication and transportation center in the region.
This led the Germans to withdraw and allowed the Russians to re-establish the front line running approximately from Riga to the southeast to Dvinsk, and then south to Minsk.
The new positions left German troops on the doorsteps of Riga, and the Stavka tasked the Twelfth Army with defending the city.
Emperor Nicholas II abdicated on 15 March 1917, and a Russian Provisional Government was established by liberal parties in the State Duma, while the Petrograd Soviet had the support of the revolutionaries, in an arrangement known as dual power.
[11][13] Amidst this situation, General Lavr Kornilov, who had been named as the head of the Petrograd Military District by the Provisional Government, began preparations in April 1917 to form a new army near the capital to counter a potential German advance in the Riga area.
[14] The Kerensky offensive coincided with the July Days, a series of protests in which soldiers of the rebellious Petrograd garrison, Baltic Fleet sailors, and Bolshevik agitators tried to overthrow the Provisional Government.
[11][15] At the Moscow State Conference in late August 1917, Kornilov warned that the Germans would capture Riga and then advance on Petrograd if order was not restored in the army.
In the early part of that month, German quartermaster-general Erich Ludendorff and Colonel Max Hoffmann planned an operation to take Riga, aimed at capturing an important industrial city along the Baltic Sea and putting pressure on Russia to sue for peace.
Gas shells, flamethrowers, and aerial attacks were also employed by the German force, but the Russians still fought off their attempts to cross for most of the day.
[17] Von Hutier had his forces use the new infiltration tactics that he took part in developing, such as moving more fluidly instead of attacking in a straight line, with one unit advancing while another provided cover fire, before later reversing those roles.
[16] At the Jugla river, the 43rd Army Corps sustained significant casualties and already had supply shortages, and as the Germans got through the more determined soldiers, the rest of the force began retreating.
German Colonel Max Hoffman noted that relatively few Russian soldiers were captured, and although they found large quantities of equipment and artillery, most of the Twelfth Army succeeded in escaping the attempted encirclement.
The fall of Riga marked the loss of a major industrial center and put German troops closer to Petrograd, though the Russian Twelfth Army succeeded in its objective of leaving the area intact and avoided being encircled.
The newspaper Novoye Vremya noted that discipline in the army had fallen so severely, especially in the Northern Front, that large numbers of troops in a fortified position with stocks of artillery and other supplies could not put up a strong fight to hold the city.
[17] At some point after his rise to prominence in August 1917, Kornilov decided to launch a coup against the Petrograd Soviet and the Bolsheviks, beginning several days after the Riga offensive.