Johannesburg (AFP) - South Africa and Nigeria stepped security on Wednesday after deadly attacks on foreign-owned stores in Johannesburg triggered reprisal assaults on South African businesses in Nigerian cities.

The centre of Johannesburg and the impoverished suburb of Alexandra were calm as police stepped up patrols following two days of looting, AFP reporters saw.

Shops cautiously began to open again, as some residents sifted around in wrecked stores, looking for food.

Amid mounting concern for relations between South Africa and its neighbours and Nigeria -- the continent's most populous market -- President Cyril Ramaphosa reiterated his condemnation of the violence.

"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 15 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."

Five people, most of them South Africans, have been killed and at least 289 have been arrested since the violence flared on Sunday.

Dozens of shops have been destroyed in Johannesburg and nearby Pretoria, the country's political capital.

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 of South Africans are unemployed.

Story continues

In Nigeria, police on Wednesday 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.

Nigeria on Tuesday summoned the South African ambassador for talks and said President Muhammadu Buhari was sending an envoy to convey his displeasure to Ramaphosa.

Similar messages of concern have been voiced by South Africa's neighbours.

In Zimbabwe, President Emmerson Mnangagwa said: "We strongly condemn all forms of hate driven violence and applaud the South African authorities for the swift way they have responded."

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."