The population exchange between Poland and the Soviet Ukraine at the end of World War II was based on a treaty signed on 9 September 1944 by the Ukrainian SSR with the newly formed Polish Committee of National Liberation (PKWN). The transfer, which took place in 1944–46 became part of a mass movement of people expelled from their homes in the process of ethnic consolidation of Central and Eastern Europe. As the new border between the postwar Poland and the Soviet Union along the Curzon Line (requested by Stalin at Yalta) has been ratified, the ensuing population exchange affected close to half a million ethnic Ukrainians as well as about 1.1 million Poles and Polish Jews. While the east-central territories of the Soviet republics remained unchanged, the westernmost regions of Ukrainian and Belarusian SSR underwent dramatic expansion at the expense of the Second Polish Republic. The so-called repatriation pertained to rural populations as much as the inhabitants of provincial capitals stripped of their prewar economic catchment areas (Grodno, Brest, Lviv, Przemyśl). About 480,000 people from Zakerzonia (west of the Curzon Line), were moved back to the territory which became part of Soviet Ukraine and Belarus.
With the signing of the agreement in September 1944, people who were required to register for resettlement were identified only by ethnicity – not by the country of birth. Ukrainians residing west of the border were required to register with the Polish authorities, while the Poles living east of the border registered with the Soviet NKVD. In order to guarantee efficiency and prevent haulage of empty wagons, refugees were loaded onto the same returning trains on both sides of the new border. According to statistics, the Poles removed before spring 1945 from the villages in Ukraine amounted to 453,766 individuals (58% of the Polish total), while the city dwellers constituted 41.7% of the total, or 328,908 Poles. The number of Ukrainians registered between October 1944 and September 1946 was 492,682. Of this total, 482,880 individuals were eventually relocated to the Ukrainian SSR, settling primarily in the Ternopil, Ivano-Frankivsk, and Lviv Oblasts (provinces), in the southern and south-western oblasts of Mykolaiv and Dnipropetrovsk, and to a lesser extent the Donbas region of Eastern Ukraine. The largest resettlement of Ukrainians from Poland took place in the border counties of Hrubieszów, Przemyśl and Sanok followed secondarily by Lubaczów, Tomaszów, Lesko, Jarosław and Chełm.