Policy implemented by the Nazi Germany and USSR in Europe in the end of 1930s was directed towards change of the existing borders in Eastern Europe. The treaty between Stalin and Hitler or the so called Molotov–Ribbentrop Pact that was concluded on 23 August 1939 and its secret protocol divided Eastern Europe into German and Soviet “spheres of influence”. From 1939 to 1940, Hitler and Stalin occupied the entire Eastern Europe. Only Finland was able to fight against the occupation. Latvia along with other Baltic states was occupied by the USSR in June 1940.
In September 1939, shortly after signing the Molotov-Ribbentrop Pact and division of Poland between Germany and the USSR, Latvia was forced to sign a treaty with the USSR on placement of military bases in the territory of Latvia.
On 16 June 1940, the USSR categorically demanded change of government in Latvia and immediate permission for the presence of the Red Army in Latvia. The next day the USSR occupied Latvia, Soviet tanks entered Rīga and captured the strategical objects. On 20 June, a new government with the ministers selected by the occupation forces was formed.
Hoping that Latvia would be allowed to retain at least a partial sovereignty, Kārlis Ulmanis, who was President and Prime Minister at that time, agreed to the Soviet demands. His actions in 1939 and 1940 have been assessed controversially. On the one hand, resistance against the predominance of the Red Army with the USSR military bases already located in Latvia was impossible and would caused heavy losses of people. On the other hand, non-resistance against the Soviet aggression allowed the USSR occupation forces to create an illusion about the “voluntary annexation” to the USSR that was carried out in line with the “public will”, moreover, thousands of Latvian citizens anyway died as a result of the Soviet repressions. Kārlis Ulmanis was deported from Latvia to the USSR on 21 July 1940. After the war broke out between the USSR and Germany, on 22 June 1941, he was arrested and put into prison. The prominent politician and the first Prime Minister of the Republic of Latvia died in the Soviet imprisonment in 1942.
Occupation and annexation of Latvia was under complete control of Andrey Vyshinsky and other USSR officials in Rīga. On 14 to 15 July 1940, “elections” were organized. The only list of candidates included people selected by the occupation forces and the results of elections were falsified. The elected “People’s Parliament”, in July 1940, immediately decided that Latvia wants to be annexed to the USSR. On 5 August 1940, in Moscow, Latvia was formally admitted to the USSR. Latvia was annexed illegitimately to the USSR and the carefully planned procedure of occupation and annexation was staged as it was a democratic expression of “people’s will”.
Until the beginning of the war between the USSR and Germany, in 1940 and 1941, the planned economy, totalitarian system and ideology was implemented in Latvia led by communists, who arrived from the USSR. Everything related to the Republic of Latvia proclaimed on 18 November 1918 had to be forgotten. However, after many years of occupation, the independent Latvia again became an ideal that in the end of 1980s united thousands of people in a fight against the Soviet occupation. On 4 May 1990, after fifty years of occupation, the Republic of Latvia, established on 18 November 1918, was restored.