Today, 60% of Africans are under 25. The UN predicts the continent’s population to reach 2.4bn by 2050, when one in four of the planet’s inhabitants will be African. These statistics demonstrate how profoundly the world’s centre of gravity continues to move away from Europe, and they explain why Theresa May is currently on a three-day visit to the continent.

Speaking in Cape Town on Tuesday, the Prime Minister argued that it is in the world’s interests to help create jobs for Africa’s burgeoning young population and committed £4bn to the task. She is right. It is no secret to young Africans that rewarding employment, a decent place to live and the prospect of one day raising a family are considered reasonable expectations by their cohort living in more prosperous parts of our inter-connected world. If they can find these things in Africa, then all is well. If they find unemployment and squalor then many will feel compelled to look elsewhere (who wouldn’t?), and Europe will be their preferred destination. Africa cannot afford to lose ambitious men and women. And Europe doesn’t want them. This is the pressing complexity behind the Prime Minister’s trade mission.

A good outcome for Africa’s new generation is achievable. States like Ethiopia, Ghana, Kenya, Tanzania and Nigeria have some of the fastest GDP growth rates in the world. The African Union is pushing a Continental Free Trade Area which would remove tariffs from 90% of goods traded across Africa, allegedly boosting intra-African trade by 52% by 2022. There are now 400 African companies with revenues of more than $1 billion and 700 with revenues of more than $500 million. Nigeria’s Dangote Cement, Africa’s biggest producer of cement, is expected to apply for a London listing in 2019. Technology is transforming how Africa’s farmers grow and market their food, while most of the continent’s fertile land remains undeveloped. And Africa is becoming a steadily more stable and secure investment location as democracy and the rule of law becomes the norm.

Over 50% of Africans now live in cities, and the pace of urbanisation is increasing. Nine of the world’s fastest growing cities are African: Bamako, Lagos, Dar es Salaam, Lubumbashi, Kampala, Luanda, Kinshasa, Nairobi and Antananarivo – these megacities are establishing themselves as dynamic centres of national and regional trading networks. Nigeria alone is predicted to account for around 35% of growth in the world’s urban population to 2050. Urbanisation experts Daniel Hoornweg and Kevin Pope have predicted that Lagos will become the world’s largest city by 2100. For most Africans, the quality of their life experience will depend upon the quality of the cities they are born in.

In the developed world the established view is that urbanisation is closely linked to rising prosperity because of the positive economic consequences of agglomeration – the proximity of a high-density population, infrastructure, businesses and skills. City authorities in Europe and the US are expected to manage the correct balance of vertical and horizontal development, combining an efficient use of space with usable infrastructure networks that allow businesses and citizens to form connections, clusters and agglomerations around a city centre and maximise access to civic services and jobs. Mobility is a key issue, with a constant emphasis on developing efficient transport systems like London’s Crossrail to connect commuters with their workplaces. In developed countries cities have become steadily bigger, richer and more culturally complex, sucking up government money for new projects and developing ever-stronger political identities. Capitals like London and New York are run as quasi city states by charismatic mayors.

Africa’s megacities have none of the luxuries – incumbent prosperity, manageable population growth, tough planning laws, well-funded municipal local governments – enjoyed by countries like the UK. Cash-strapped, most city authorities are plagued by short-termism, corruption and weak land governance, while national governments are often unsupportive. The African Development Bank Group (AfDB) has identified a lack of local government capacity as urban Africa’s biggest challenge. Some cities have attempted reforms: the Lagos Innovation Council is trying to create business friendly ecosystems across the city, and Angola’s sovereign wealth fund is sponsoring an African Mayoral Award to reward best practice in local government. But these initiatives scratch the surface.

Weak urban governments struggle to control the trajectory of their city’s development. This is a deadly serious problem. Africa’s megacities are growing horizontally rather than vertically, creating vast urban sprawl. Cities like Kinshasa and Lagos possess crumbling city centres surrounded by dense informal settlements with non-existent infrastructure or civic services. Poor transport infrastructure makes commuting between the centre and residential areas slow (many have no choice but to walk, or take expensive taxis), and fragments the city into disparate communities. Instead of adding density to the centre by building vertically, developers choose greenfield sites on the edge of the sprawl to site middle class accommodation and business parks. The result is cities with low economic density and high living costs that struggle to function as a coherent, integrated unit, are unable to trigger the benefits of agglomeration, and are poorly connected with the regional and global economy.

Without transformative interventions Africa’s megacities will fail to become engines of economic development. Instead they will trap tens, maybe hundreds of millions of Africans in urban poverty, and force millions more to migrate away from their homes and families in search of something better.

The answer is urgent investment in municipal government, tougher planning and building regulations, comprehensive infrastructure building programmes and billions of pounds in funding.

This challenge creates an opportunity for the UK. Alongside our expertise in development aid, Britain has skills in urban planning and design, transport systems, local government and education. London is possibly the greatest agglomeration the world has ever seen, and a global centre for everything from infrastructure financing to fintech. In places like the Golden Triangle, connecting London, Oxford and Cambridge we may be about to create a wealth cluster to rival Silicon Valley. In Manchester, Birmingham, Sheffield and Middlesbrough we have newly elected metro mayors ambitious to promote their city’s expertise and forge new international links. UK universities have been leaders in developing innovative relationships overseas.

Britain’s urban experience is far from perfect, and our expertise won’t always apply to Africa’s crowded, chaotic cities but if we really want to make a difference, this is where we should focus our help.