The occupation of the Baltic states involved the military occupation of the three Baltic states—Estonia, Latvia and Lithuania—by the Soviet Union under the auspices of the 1939 Molotov–Ribbentrop Pact in June 1940. They were then annexed into the Soviet Union as constituent republics in August 1940, though most Western powers and nations never recognised 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.