Residents of a South African township near Johannesburg have set ablaze the homes of migrants they believe are illegally working in disused local mines.
There has been widespread anger after a large group of miners were accused of the gang rape of eight women last week.
Dozens of people are being held by the police in connection with the assault but none have been charged with rape.
In recent years, poverty has been one of the drivers of xenophobic attacks.
Some believe – whether rightly or wrongly – that foreigners are the cause of many of their difficulties.
People in Kagiso say the foreign miners – known locally as Zama Zamas – are responsible for crime in the area. The sexual assaults last week in nearby Krugersdorp inflamed tensions and residents called for a demonstration.
On Thursday morning, police, both on the ground and in helicopters, fired stun grenades and rubber bullets to disperse angry mobs who were chasing the miners.
People armed with garden tools forced them to seek safety in old underground mine ventilation shafts.
A journalist from national TV station eNCA described seeing naked men being marched through the area and then beaten.
The police detained 22 men who had been targets of the violence in a move that may have been to prevent them being lynched.
There are reports that one person has been found dead, but it is unclear if the death is related to the protest.
Rocks, rubble and burning tires have been used to block major roads in the township.
People in Kagiso are now saying they fear reprisal attacks at night time.
Last week, women, aged between 19 and 35, who were part of a group reportedly filming a music video near a disused mine were attacked and raped by dozens of people.
President Cyril Ramaphosa described the attack on the women as the “ugly and dark side of society”.
The high levels of sexual violence in the country have led to frequent calls for more to be done to prosecute the perpetrators.
At least 130 men have been detained following the assault but many are facing charges relating to their immigration status as well as the illegal possession of firearms and explosives.
The police say they are waiting for DNA tests to be concluded before charging people with rape.
The miners – most of whom come from neighboring countries – work in unsafe and unregulated conditions in the abandoned mineshafts that surround Johannesburg.