The police were met with violent resistance on Friday morning as they removed hundreds of refugees from the UN High Commissioner for Refugees' (UNHCR) offices in Pretoria.
They arrived in numbers and slowly moved through the property, with some carrying shields while the arresting officers were behind them.
Many refugees resisted arrest and fought back, bashing against the police shields and throwing rocks, cans of food, water buckets and other items at the officers. Others sat in a group and refused to move or be removed.
The police used force to detain the refugees but no rubber bullets, stun grenades or tear gas were used during the operation.
At least four officers were injured after being struck with rocks.
Police spokesperson Brigadier Mathapelo Peters confirmed the injuries, saying they were treated by paramedics at the scene.
Some of the refugees were also injured during the clashes.
Dozens of women and crying children pleaded with police to leave them alone. They questioned their authority to effect arrests, accusing them of being xenophobic.
The operation, which lasted about an hour, ended as the last group of refugees handed themselves over.
Men were loaded into police trucks and taken to Brooklyn police station to be processed. Once Brooklyn is full, arrested refugees will be transported to other police stations in Pretoria.
Peters said women with children would be handed over to the social development department and taken to places of safety.
"What we have tried to do is to keep them with their mothers, not to separate them from their mothers, but those women who don't have children were arrested alongside the men."
Peters said immigration officials would also be conducting a verification process to ascertain the status of the refugees who were arrested inside the UN compound.
"I think it [the operation] went quite well although we did not anticipate the kind of violent resistance that we were met with, but I think we handled the situation very well."
News24 reported that a case of trespassing was opened against the refugees after they forced their way onto the UNHCR premises on Thursday morning in an attempt to avoid a Gauteng High Court order that was handed down in Pretoria on Wednesday.
The order, which was served by the Sheriff of the High Court, gave the refugees three days to vacate the area.
Since the beginning of October, refugees have been living on pavements outside the UNHCR's offices in in tents and makeshift structures. They want to be resettled in another country as they fear xenophobic attacks in South Africa.
Their presence led to an urgent application by the Waterkloof Homeowners' Association and Brooklyn and Eastern Areas Citizens' Association.
They argued that the refugees, who are the first respondents in the application, were in contravention of municipal by-laws and other applicable laws.
All pictures by Alex Mitchley