Latvia states of Northern and Eastern Europe were divided into German and Soviet "spheres of influence". In the north, Latvia, Finland and Estonia were assigned to the Soviet sphere. A week later, on 1 September 1939, Germany and on 17 September, the Soviet Union invaded Poland. After the conclusion of the Molotov-Ribbentrop Pact, most of the Baltic Germans left Latvia by agreement between Ulmanis' government and Nazi Germany under the Heim ins Reich programme. In total 50,000 Baltic Germans left by the deadline of December 1939, with 1,600 remaining to conclude business and 13,000 choosing to remain in Latvia. Most of
Germany–Poland border the Slavic tribes. Over several centuries, it has moved eastwards, stabilized in the 14th century, and disappeared in the late 18th century with the partitions of Poland, in which Poland's neighbors, including the Kingdom of Prussia, annexed all of its territory. In 1871 Prussia became part of the German Empire. After Poland regained independence following World War I and the 123 years of partitions, a long German-Polish border was settled on, long (including a border with East Prussia). The border was partially shaped by the Treaty of Versailles and partially by plebiscites (East Prussian plebiscite and the Silesian plebiscite, the