A state that existed on the territory of the former Baltic governorates of the Russian Empire.
After the February Revolution of 1917, the Latvian national movement began to develop actively in Livonia (Vidzeme), Courland (Kurzeme), and Latgale (the western part of the Vitebsk governorate). However, the activities of supporters of the independent Latvian state in the territories occupied by the German army were banned. After Germany’s defeat in World War I in November 1918, the leaders of Latvian political parties and movements established the People’s Council. On November 18, the People’s Council proclaimed the independence of the Republic of Latvia, and on November 19 it approved the first Provisional Government headed by Kārlis Ulmanis.
In early December 1918, the Provisional Workers’ and Peasants’ Government of Latvia was established in the Russian SFSR and the offensive of the Workers’ and Peasants’ Red Army began. By mid-January 1919, the Reds controlled most of Latvia. On January 13, the Latvian Socialist Soviet Republic was proclaimed in Riga. Only the western districts of Courland with a center in Liepaja remained under the control of the Ulmanis’ government. It was defended by the Baltic Landeswehr and the Iron Brigade consisting of Germans included in the armed forces of the Republic of Latvia.
In March 1919, the Latvian army started a counteroffensive, which stopped on the outskirts of Riga due to the conflict between the Ulmanis’ government and the German military. On April 16, a coup took place: pro-German Latvian politicians formed a new government headed by Oskar Borkowski, and then by Andrievs Niedra. On 22–23 May, it moved to Riga after its capture by the Baltic Landeswehr, the Iron Division, and detachments of the Southern Group of the Latvian Army. At the same time, units of the Estonian army and detachments of the Northern Group of the Latvian Army, loyal to the Ulmanis’ government, successfully marched against Soviet Latvia from the north. In June, they met with the German units of the Republic of Latvia and began to fight them. After the Battle of Cēsis on June 19–23, 1919, and the defeat of the Baltic Landeswehr, the Niedra's government ceased its activities. Under the terms of the armistice, the German troops had to leave Latvia. On July 8, the Ulmanis’ government, which was taking refuge on the steamer Saratov, returned to Riga under the protection of the Entente squadron.
In August 1919, the British military tried to organize a general offensive of all anti-Bolshevik forces of the Baltic region against the Russian SFSR. For this purpose, on September 5, by order of General Nikolai Yudenich, all White troops on the territory of Latvia were united in the Western Volunteer Army (WVA) under the command of Pavel Bermondt-Avalov. By the end of September, there were up to 52,000 troops in the WVA, including about 40,000 German volunteers. Expecting support from Germany, Bermondt-Avalov announced the assuming of all power in the Ostsee governorates of Russia and refused to obey Yudenich. By October 10, 1919, WVA units had reached Riga and occupied most of Courland. At the request of the Latvian government, the British fleet hastily arrived in the Gulf of Riga, and Estonian troops entered Riga. By December 1, they had pushed the WVA to Germany.
In early 1920, a joint offensive of the armies of Latvia and Poland against the Latvian SSR, which controlled Latgale, began. In February, the Reds were forced out of the country. The establishment of peaceful relations with Germany in June and the conclusion of a peace treaty with the Russian SFSR in August 1920 put an end to the war in Latvia.
In April 1920, elections to the Constitutional Assembly of Latvia were held. On May 27, the Assembly adopted a declaration on the State of Latvia as a sovereign republic with a democratic structure. The first coalition government was headed by Ulmanis, the leader of the Latvian Peasant Union. On November 7, 1922, the Сonstitution came into force and the process of formation of the Republic of Latvia was completed.