Jacob Zuma, South Africa's president: the courts have delivered two high-profile judgments against his government © AFP

Sub-Saharan Africa’s voice on the global stage has been at its strongest over the past two decades when its two most powerful players have worked in concert. However, nearly ten years of deteriorating relations have seen the foundations for collective action — laid by Thabo Mbeki, the prickly intellectual who succeeded Nelson Mandela as South African head of state, and Olusegun Obasanjo, the gruff former military ruler elected as Nigeria’s civilian leader in 1999 — all but destroyed.

The men had a shared history dating back to the late 1970s when Nigeria was among the most generous and outspoken of African states supporting African National Congress exiles in their struggle against apartheid.

In power, they formed a formidable axis, making full use of international connections to map out a collaborative approach to the continent’s economic and political future. Sadly, the work they did has been squandered by their successors. More often than not in recent times the two countries have found themselves on opposing sides of continental fracas.

Relations have reached a new low in the past ten days when anti-immigrant mobs have singled out Nigerians in a wave of xenophobia sweeping South Africa. Protesters in Abuja retaliated last Thursday by attacking and looting the west African headquarters of MTN, South Africa’s flagship mobile telephone operator. One Nigerian student group is demanding that all South African businesses close and leave.

There is a risk of an escalation, one which would damage bilateral commercial ties and weaken Africa’s capacity for influence at a time when uncertainty elsewhere has pushed the continent’s priorities near to the bottom of the global agenda. A great majority of Nigerians and South Africans have no cause for mutual enmity but it would be foolish for the governments to ignore virulent voices on the fringe.

Disturbingly in Pretoria, South African First, a political movement with a xenophobic agenda, was registered in December. It may not get far in elections initially but its message has resonance in poorer townships, where black South Africans rail against other Africans — from Zimbabwe, Nigeria, Somalia and Mozambique — who have often proved successful in their communities. The party blames foreigners for crime, wants to drive them out of the country and preserve scant economic opportunities for South Africans.

The response in Nigeria may be largely reactive but it should nonetheless ring alarm bells in Pretoria. The continent’s most populous nation is a vital market for South African hotels, banks, technology companies and supermarkets. More than 100 companies have invested there, bringing with them jobs and know-how. Nonetheless Nigerians resent the profits these companies export back home, exemplified by a senate investigation into alleged transfer pricing by MTN.

Between them, South Africa and Nigeria make up about half of Africa’s overall economic output. Their commercial interests are mostly complementary. It would be a tragedy if they succumbed to the nationalist rhetoric infecting and weakening the developed world.

Both governments face domestic crises exploitable by populists. They have a shared interest in putting out the bush fires as quickly as possible. That means stamping on intolerance and working hard to remind their respective publics of a shared history of which they can be proud.

Africa has enough pressing challenges without its most powerful nations fighting by proxy on the streets.

Copyright The Financial Times Limited 2018. All rights reserved.