1026 GMT June 27 2017
Shops and homes owned by foreigners have been looted and torched over the last two weeks, with some South Africans alleging that the properties were drug dens, AFP reported.
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 as tensions rise between some South Africans and migrants from Nigeria, Zimbabwe, Somalia, Pakistan and elsewhere.
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, while some demonstrators wielded rocks and machetes, AFP reporters witnessed.
President Jacob Zuma condemned the latest wave of xenophobic unrest, 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 on Friday.
Zuma called for South Africans not to use migrants as a scapegoat for the country's widespread crime problems, but said the government would crack down on drug-dealing and illegal immigrants.
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.