But in the larger scheme of things, xenophobia is a distraction from the leadership role that Nigeria and South Africa should play on the continent on fundamental issues of immigration and economic integration.

A constant irritant

Accurate figures are hard to get. But Statistics South Africa put the number of Nigerian migrants at about 30,000 in 2016, far below Zimbabweans and Mozambicans.

Xenophobia has remained a constant irritant in Nigeria-South Africa relations since the major attacks on African migrants in poor neighbourhoods in Cape Town, Durban and Johannesburg in 2008 and 2015. But, contrary to popular perception, xenophobic attacks do not disproportionately target Nigerians. Nigerians often exaggerate the effect of violence on their citizens. That is probably because Nigeria has a better organised, savvy, and loud diaspora constituency in South Africa.

Unfortunately, the loudness of the Nigerian diaspora transforms victimhood into foreign policy, generating the reactions that have been witnessed recently. It also plays into the naïve narrative of the "liberation dividend". This entails Nigerians seeking to be treated uniquely because of their contribution to the struggle for majority rule in South Africa. There were no such expectations from the other countries that supported South Africa's liberation struggle.

This narrative has taken on an equally economic tinge. South African companies are heavily invested in Nigeria. So, they often become targets of Nigerian ire in times of xenophobia.

The accurate picture is that xenophobia affects all African migrants. These are mostly migrants from Malawi, Zimbabwe, Mozambique and, increasingly Ethiopians, Kenyans and Somalis. Nigerians are affected. But they're not on top of the list.

Migrants are easy targets. That's because they are seen as being better off by the locals. They therefore become targets of people who feel their circumstances have not been addressed by government. It is no surprise that xenophobic attacks have typically occurred in poor neighbourhoods that have been affected by service delivery protests since the mid-2000s.

Second, xenophobia thrives on ineffective policing in South Africa. Barely two days after the Johannesburg attacks started, the national police spokesman admitted that the police were running out of resources to manage the violence. This prompted the Premier of Gauteng, the country's economic hub, to threaten to also deploy the army if the violence continued.

But the police are sometimes complicit in stoking anti-foreign sentiments. The July 2019 raids on foreign-owned businesses in Johannesburg in apparent efforts to stamp out illicit goods added to the current climate of xenophobia. When some business owners retaliated against the police, some local leaders appropriated the language of "threats on South Africa's sovereignty" to justify the police response.

Reforms are urgently needed to create a competent, less corrupt, better-resourced, and civic-minded police service.

Xenophobia is also an outcome of a rickety migration and border control regime. Efficient border controls are one of the hallmarks of sovereignty and the first line of defence against xenophobia. Broken borders breed criminality. These include human and drug trafficking. Human and drug trafficking feature prominently in the discourse on xenophobia in South Africa.

How, then, does xenophobia distract South Africa and Nigeria from what should be their leadership on core African issues?

Overreaction

The weighty issues of creating a humane and just society for South Africans and migrants alike will ultimately be led by the South African government. Outsiders can make some diplomatic noises and occasionally boycott South Africa. But these actions are unlikely to drive vital change.

In fact, the overreactions by Nigeria and other African countries simply undercut the South African constituencies that have a crucial stake in wide-ranging reforms that address the multiplicity of problems around xenophobia.

In the previous instances of xenophobic violence, Nigeria urged the African Union (AU) to force South Africa to take action. But such unhelpful statements only inflame passions and prevent civil diplomatic discourse.

Instead, the best policy would be for Nigeria to engage South Africa through their existing binational commission. Nigerian President Muhammadu Buhari is scheduled to visit South Africa next month.

Taking the lead

Rather than the perennial relapse into shouting matches and hardening of rhetoric, it is essential for Pretoria and Abuja to take decisive leadership at the continental level. The two nations must articulate immigration policies.

Also, without the leadership of its two major economies, Africa is not going to make any traction on the new treaty establishing the African Continental Free Trade Agreement. Ironically, the WEF meeting in Cape Town addressed ways to boost intra-African trade. Nigeria should not have boycotted it because of xenophobia.

Author: Gilbert M. Khadiagala - Jan Smuts Professor of International Relations and Director of the African Centre for the Study of the United States (ACSUS), University of the Witwatersrand