By a wafer-thin margin of 1.2 million votes, Britain last week voted to exit the European Union. The ongoing tussle between “Euroscepticism” and “Europhoria” seemed to have tilted in favour of the former.

The knock-on effects of the Brexit are just beginning to crystallize and, in truth, there is no telling whether the worst of the storm is behind us or still in the build-up phase waiting to pound. One critical issue, however, is what impact this will have for Africa’s economy. After all, the continent has been increasing regional integration over the past decade – and has looked to the European Union model as a guide.

The biggest threat to integration: mismanaged migration

One of the key issues that drove Britain’s “Leave” campaign was growing concern that immigrants were exerting pressure on the country’s strained resources. Of course, as the Office of National Statistics reported in its May 2016 report, over half of growth in employment in the previous 12 months was driven by foreign nationals, and these same people are on the whole net contributors to Britain’s economy.

But figures like this mean nothing to people worried about being displaced from their jobs by immigrants, and this scarcity complex – an irrational fear that there are only so many jobs to go around, and they must be reserved for locals – is probably one of the biggest hurdles to any plans for regional integration.

Take the example of South Africa, where deteriorating economic conditions led to a growth of anti-immigrant sentiment – and with it an increase of xenophobic attacks. Over in Zambia, a recent spate of xenophobia-tinged unrest claimed at least two lives. And while East Africa may not have suffered from such shocking events, the move to eliminate work permit requirements has been slow – only Kenya and Rwanda have done so with one another – pointing to similar fears.

The key to success: integration

An important part in this debate – and one that is very rarely mentioned – is that of integration of migrants. When the EU expanded to include countries like Poland and Slovakia in 2004, the British government predicted 15,000 of them would move to the country for work each year. Two years later, that figure stood at over 400,000.

If regional integration is to be a success, governments must do a better job of preparing their populations: locals need to know that they will be able to live alongside and benefit from migrants (and vice versa). Additionally, migrants need to be sensitized to local customs that will help them integrate into the local environment.

If there is acrimony between the groups, it can cause barriers to the regional integration processes that hinge, in part, on free movement of labour across borders. In sub-Saharan Africa, and in other regions affected by the downturn in commodity prices, this is particularly important, as recent economic developments could lead to an increase of vulnerable employment, especially in economies like Nigeria, Angola and Gabon.

And that’s worrying, because the situation is already far from perfect. For example, according to the African Development Bank’s visa openness index, Africans on average need visas to travel to 55% of other African countries, can get visas on arrival in only 25% of other countries, and can benefit from visa-free travel in only 20% of countries on the continent. Only 13 countries allow visa-free travel to all African citizens.

A plan for making immigration – and regional integration – work

One step towards arresting anti-immigrants sentiment would be to accelerate the structural transformation of sub-Saharan Africa’s economy away from commodities as the key growth engine, and towards the more labour-intensive manufacturing sector, which could help absorb the fast-growing pool of unemployed and under-employed youth into the labour force.

In economies such as Ethiopia, this transformation is under way, through the Growth and Transformation Plan. Just recently, the World Bank reported that among those jobs created through foreign direct investment in the country, the manufacturing sector created the most permanent employment opportunities between 2010 and 2015. This has been made possible through interventions such as the improvement of trade logistics, the facilitation of linkages to markets, and competitive wages, effectively helping to scale up productivity in the sector.

Learning from Brexit

Migration is inevitable, and throughout history nationalism and xenophobia has been an unwanted side-effect of this. But governments must take steps to limit these negative repercussions.

The solutions we’ve outlined here – increase foreign direct investment, combined with programmes to develop skills in the local workforce – is only one way of ensuring we reap the benefits offered by regional integration.

So while the effects of Britain’s decision to leave the EU are still being felt across the world, African leaders should look to it as a warning sign, and learn lessons from Britain’s failed, but noble attempt at regional integration.