Presidents Muhammadu Buhari and Cyril Ramaphosa Picture: Siyabulela Duda/GCIS

Johannesburg - South Africa and Nigeria signed 30 trade and cooperation agreements on Thursday, weeks after a wave of violence against Nigerian nationals in Johannesburg and Pretoria had strained relations between Africa's top two economies.

In September, mobs armed with makeshift weapons attacked businesses and homes owned by foreigners, leading to at least 10 deaths, dozens of injuries and up to 400 arrests.

In response Nigeria repatriated around 600 of its citizens living in South Africa.

Presidents Cyril Ramaphosa and Muhammadu Buhari, at the conclusion of a two-day visit by the Nigerian leader, said they regretted the violence and subsequent retaliation in Nigeria against South African businesses, pledging instead to deepen trade ties.

The local units of South African telecoms company MTN and supermarket chain Shoprite closed all stores and service centres in Nigeria after their premises were attacked by Nigerians protesting against attacks on their compatriots in South Africa.

"As the government of South Africa, we have expressed our deep regret at the attacks directed at foreign nationals and our condemnation of all forms of intolerance and acts of violence," Ramaphosa told journalists.

Ramaphosa said the two countries had sealed 32 bilateral agreements and memoranda of understanding covering trade and industry, science and technology, defence, agriculture and energy.

Nigeria accounts for 64 percent of South Africa’s total trade with the West African Region and is one of its largest trading partners on the continent.

Buhari said beyond the economic partnership the anti-foreigner violence had to be addressed quickly.

"We decided to take concrete measures to prevent the recurrence of such unacceptable incidents in the future," Buhari said.