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
Latvia–Russia border On 16 January 1945, the area was transferred from the Latvian Soviet Socialist Republic to Pskov Oblast and renamed Pytalovsky District. Ever since Latvia regained independence, Latvia claimed the previous Latvian territory, on the basis of the 1920 Treaty of Riga. In 2007 a treaty on the Russian-Latvian state border was signed and ratified, and the Pytalovsky District remains part of Russia. Passage of the state border between the Russian Federation and the Republic of Latvia is determined on the basis of arrangements. According to the agreement on the Russian-Latvian State Border, the state border between Latvia and Russia starting