South Africa temporarily halted the deportation of 200 foreigners on Tuesday after a legal challenge by a human rights group, which said authorities were unfairly targeting them following anti-migrant riots in which seven people were killed.
More than 800 undocumented migrants have been arrested across South Africa in the past three weeks under "Operation Fiela", a series of raids launched after last month's violence which was centred on the province of KwaZulu Natal.
But the Lawyers for Human Rights (LHR) group filed a petition in court on Tuesday seeking legal access to detainees arrested last week, and asked the Home Affairs Ministry to halt their deportations which were due to start on Wednesday.
Wayne Ncube, coordinator of the migration detention unit at LHR, said Home Affairs officials had agreed to halt the deportation for two weeks to ensure that the 200 migrants arrested at a Methodist Church in the early hours of Friday morning had a chance to get legal representation.
"We settled on an order whereby we will get access to all the detainees who were arrested as part of Operation Fiela," Ncube said. "A list will be compiled and handed over to us regarding every person who was arrested."
The violence, which ended after troops were sent to affected areas, flared up after Zulu King Goodwill Zwelithini said in remarks reported by local media that foreigners should leave South Africa.
Zwelithini has since said his comments were misinterpreted.
Unemployment, which economists say is much higher than the official rate of around 25 percent, has been blamed for periodic outbreaks of anti-immigrant violence along with widespread poverty and income disparities.
The government has denied that Operation Fiela is targeting foreign nationals. "We would like to categorically and emphatically state that these claims are far from the truth," spokeswoman Phumla Williams said in a statement.
"This is an operation aimed at making our country safer to enable all people who live in our country to enjoy their freedoms in an environment that is free from crime."
The People's Coalition Against Xenophobia has held two protests outside the Johannesburg Central Police Station to oppose the arrests and detention of foreign migrants.
"To equate crime to the presence of undocumented people in our society is not tackling xenophobia, it's legitimising xenophobia," the group's coordinator Stephen Faulkner said. "It is saying to the general public, we have to tackle xenophobia by getting rid of illegal immigrants."