In accordance with the Molotov–Ribbentrop Pact of August 1939, the city became part of the Byelorussian Soviet Socialist Republic of the Soviet Union, and several thousand of the city's Polish inhabitants were deported to remote areas of the Soviet Union. On 23 June 1941 the city came under German occupation that lasted until 16 July 1944. Surviving inmates of the Grodno prison were released and the scale of the NKVD prisoner massacres revealed.&lt;ref name="ipn/pdf"&gt;