Human Rights Watch has called on the Ukrainian authorities to immediately release migrants and asylum seekers who are arbitrarily detained and at heightened risk due to military activity in the vicinity.
Up to 15 nationalities are being held in the Zhuravychi Migrant Accommodation Centre in Volyn oblast, including people from Syria, Algeria, and Afghanistan.
"Migrants and asylum seekers are currently locked up in the middle of a war zone and justifiably terrified," Nadia Hardman of HRW said.
"There is no excuse, over a month into this conflict, for keeping civilians in immigration detention. They should be immediately released and allowed to seek refuge and safety like all other civilians."
The rights watchdog said that it had interviewed four men being held in the former military barracks in northwestern Ukraine who said they had been detained for trying to cross into Poland or staying in Ukraine after their student visas expired.
Three men said that after they were handed to Ukrainian border guards after being captured by Polish guards, they were sentenced to 6-18 months after a court case in which they did not have legal representation and were not offered the right to claim asylum.
"Whatever the original basis for their detention, their continued detention at the centre is arbitrary and places them at risk of harm from the hostilities," according to Human Rights Watch.
Ukrainian soldiers are actively using one of the buildings in the detention centre complex.
Detainees have tried to protest conditions inside the centre but Ukrainian guards instead beat the detainees with batons and their bare hands, rendering one of them unconscious, according to the watchdog.
The refugees were told they could leave Zhuravychi detention centre and would be granted Ukrainian citizenship if they joined the war but they refused.
Five of the detained men were released on 18 March after their embassies intervened and helped them travel to the Polish border.
The EU funds border control in Ukraine and the construction of security systems at this detention centre. "Now that Ukraine has become a war zone, the EU should do all it can to secure the release and safe passage of people detained in Ukraine because of their migration status," the rights watchdog said.
At the beginning of March, when thousands started to escape the fighting in Ukraine, there were widespread reports about African students being racially profiled at the border where Ukrainians were given priority to leave whilst they waited for days without food or blankets.
One young woman from Sierra Leone recalled how Ukrainian border guards boarded a bus heading for the Polish border and asked her and the other black passengers to get off.