The Soviet Union occupied the Baltic states under the auspices of the 1939 Molotov–Ribbentrop Pact in June 1940. They were then incorporated into the Soviet Union as constituent republics in August 1940, though most Western powers never recognized their incorporation. On 22 June 1941, Nazi Germany attacked the Soviet Union and, within weeks, occupied the Baltic territories. In July 1941, the Third Reich incorporated the Baltic territory into its "Reichskommissariat Ostland". As a result of the Red Army's Baltic Offensive of 1944, the Soviet Union recaptured most of the Baltic states and trapped the remaining German forces in the Courland pocket until their formal surrender in May 1945. The Soviet "annexation occupation" () or occupation "sui generis" of the Baltic states lasted until August 1991, when the three countries regained their independence.