The death toll rose to seven after two charred bodies were found in a store in Johannesburg's Alexandra township
South Africa and Nigeria stepped up security on Wednesday after deadly attacks on foreign-owned stores in Johannesburg triggered reprisals against South African businesses in Nigerian cities.
Despite a downturn in violence, tensions rose on the diplomatic front, as Nigeria declared it would boycott a top business forum and South Africa's neighbours urged Pretoria to clamp down on xenophobia.
The death toll rose to seven after two charred bodies were found in a store in Johannesburg's Alexandra township, police said. Nearly 300 people have been arrested.
The centre of Johannesburg and Alexandra remained calm, however, as police boosted patrols following two days of looting, AFP reporters saw.
Shops cautiously re-opened again as some residents sifted around in wrecked stores, rummaging for food and anything usable.
President Cyril Ramaphosa reiterated his condemnation of the violence, but acknowledged: "We face a huge challenge."
"A number of people (are) taking the law into their own hands," he said in Cape Town, ahead of a three-day meeting of the World Economic Forum (WEF) due to be attended by more than a dozen African leaders.
"Taking action against people of other countries is not right," he said. "South Africa is home for all. We are not the only country that has become home for people fleeing."
Dozens of shops have been destroyed in Johannesburg and nearby Pretoria, the country's political capital, since the violence began to flare on Sunday.
Trucks suspected of being driven by foreigners have also been torched in the southeastern province of KwaZulu-Natal.
South Africa is a major destination for economic migrants from neighbouring Lesotho, Mozambique and Zimbabwe. But others come from much farther away, including South Asia and Nigeria.
The influx has led to sporadic outbreaks of violence against foreign businesses, sparked by the perception that jobs are being taken away from South Africans
In 2008, xenophobic violence left 62 dead, while in 2015, seven people were killed in attacks in Johannesburg and Durban.
But the latest rash of attacks has sparked particular concern. It comes against a background of persistently grim news about the economy. Nearly one in three South Africans are unemployed.
In Nigeria, police said security had been strengthened around South African businesses after apparent reprisal attacks in several cities against stores operated by the supermarket chain Shoprite, the telecoms giant MTN and other firms.
But in the capital Abuja, a crowd of more than 100 demonstrators clashed with police outside a shopping mall which has a Shoprite store.
They burned tyres and hurled rocks before being repelled by a dozen police, an AFP journalist saw.
MTN's Nigeria offshoot announced it was temporarily closing all its stores in Nigeria as a precaution.
Diplomatic tensions also rose, with Nigeria declaring it would boycott the WEF in Cape Town, which was to be attended by its vice president, Yemi Osinbajo.
On Tuesday, Nigeria summoned the South African ambassador for talks and said President Muhammadu Buhari was sending an envoy to convey his displeasure to Ramaphosa.
Nigerian celebrities also took to social media in outrage, with music star Burna Boy leading calls for a boycott of South Africa while fellow stars Teni the Entertainer, Tiwa Savage and Davido condemned the violence.
Amnesty International said the attacks on foreigners targeted a "vulnerable group" in South Africa.
This, it said, was "a direct consequence of years of impunity and failures in the criminal justice system."
Similar messages of concern were voiced by South Africa's neighbours.
In Zambia, about a thousand students demonstrated outside the South African embassy in Lusaka, as President Edgar Lungu urged measures to prevent xenophobia from escalating into "genocide."
Zambia on Tuesday also cancelled a friendly football match against South Africa, scheduled to take place in Lusaka at the weekend.
In Botswana, the ministry of international affairs and cooperation urged all citizens living in or travelling to South Africa "to exercise extreme caution... (and) avoid areas where unrests are currently occurring."
In Johannesburg's Alexandra township, foreign business owners were disconsolate as they surveyed their ruined possessions.
"It’s the first time this happened," said Ashi Ashfaq, a Pakistani, who lost three of his six shops to arson.
"Before it happened, but they weren’t burning the shop, just stealing. When they burn the shop you lose everything."
He added: "(Before) they were maybe stealing little things, and that was better.”