The Latvian Soviet Socialist Republic (Latvian: Latvijas Padomju Sociālistiskā Republika; Russian: Латвийская Советская Социалистическая Республика Latviyskaya Sovetskaya Sotsialisticheskaya Respublika), also known as the Latvian SSR for short, was one of the republics that made up the Soviet Union. Established on 21 July 1940 as a puppet state during World War II in the territory of the previously independent Republic of Latvia after it had been occupied by the Soviet army on 17 June 1940 in conformity with the terms of 23 August 1939 Molotov-Ribbentrop Pact. The Latvian SSR was formally annexed into the Soviet Union (USSR) on 5 August 1940, when it nominally became the 15th constituent republic of the USSR. Its territory was subsequently conquered by Nazi Germany in 1941, before being retaken by the Soviets in 1944–1945. The independence of Republic of Latvia was restored on 21 August 1991.