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
Finland–Russia border which there is a maritime boundary between the respective territorial waters, terminating in a narrow strip of international waters between Finnish and Estonian territorial waters. The first border treaty concerning this border was signed in Nöteborg in 1323, between Sweden (to which Finland belonged) and the Novgorod Republic. The Treaty of Teusina in 1595 moved the border eastward. In conclusion to the Ingrian War, Sweden gained a large tract of land through the acquisition of the Nöteborg fortress, the Kexholm and its large province, southwest Karelia and the province of Ingria in the Treaty of Stolbovo (1617). The Treaty of