South African police fired rubber bullets, tear gas and stun grenades to break up clashes between local protesters and immigrants in Pretoria on Friday at a march against foreigners.
Shops and homes owned by migrants have been looted and torched over the last two weeks, with some South Africans alleging that the properties were brothels and drug dens.
Attacks against foreigners in the country have erupted regularly in recent years, fuelled by high unemployment and dire poverty.
Riot police in Pretoria formed lines to keep apart about 1,000 protesters.
Tensions have been rising over migrants from Nigeria, Zimbabwe, Somalia, Pakistan and elsewhere.
"We support the police," South African marcher Aysha Ali, 25, told AFP.
"Nigerians are very bad, they are bringing drugs into our community. I support the protest."
As police struggled to impose control, Mohammed Abdi, 31, from Somalia, told AFP: "We are looking for peace. People say we foreigners are here to sell drugs? They can search our shops."
Some officers shot rubber rounds at close range at protesters lying on the ground, and police used water cannon against demonstrators who wielded rocks and machetes.
We are not xenophobic
President Jacob Zuma condemned the latest wave of xenophobic unrest and called for calm and restraint saying that there had been "destruction of property directed at non-nationals."
"Residents in some communities blame non-nationals for the escalating crimes especially drug trafficking," the presidency said in a statement.
Zuma called for South Africans not to use migrants as a scapegoat for the country’s widespread crime, but said the government would crack down on drug-dealing and illegal immigrants.
But he said the fight against crime should not be labelled xenophobic.
"We are not a xenophobic country and we would not have such a number of immigrants within our country and at our borders, many of whom have genuine reasons of fleeing their countries including economic and education opportunities, if we were a xenophobic country," he said in a separate statement.
We are not scared
In the last week, more than 20 shops have been targeted in Atteridgeville, outside Pretoria, while residents in Rosettenville, south of Johannesburg, attacked at least 12 houses.
"We have decided to not leave the house (during the march)," Alain Bome, a 47-year-old from the Democratic Republic of the Congo who has been in South Africa for 14 years, told AFP.
"We know very well there have been attacks. We are scared."
Police said at least 136 people had been arrested over the last 24 hours in relation to the march.
The Nigerian government this week called for the African Union to step in to stop "xenophobic attacks" on its citizens in South Africa, claiming 20 Nigerians were killed last year.
South African authorities dismiss such numbers, saying many violent deaths in the country are due to criminal activity rather than anti-immigrant sentiment.
In 2008, South Africa experienced its worst bout of xenophobic violence, which left 62 people dead.
In 2015, at least seven people died in similar unrest in Johannesburg and the Indian Ocean city of Durban as African immigrants were hunted down and attacked by gangs.
Finance Minister Pravin Gordhan said this week that 35 percent of the labour force was unemployed or has given up looking for work.