Shortly before the Soviet-German war, significant territorial changes occurred on the Western Ukrainian ethnic lands. In March 1939 Carpatho-Ukraine declared its independence from Czechoslovakia but it was almost immediately occupied by the Kingdom of Hungary. East Galicia and Western Volyn were annexed by the USSR from Poland in October 1939, then the Soviet Union annexed Northern Bukovina and Bessarabia from the Kingdom of Romania in July 1940, due to the Molotov–Ribbentrop Pact.