Want smart analysis of the most important news in your inbox every weekday, along with other global reads, interesting ideas and opinions? Sign up for the Today’s WorldView newsletter.

CAPE TOWN, South Africa — There was a strange atmosphere at the edge of Africa. Cloudless skies and balmy spring breezes greeted the delegations of regional and business leaders who met last week for a major annual summit on the future of the continent. But they gathered in a city reeling from trauma.

After news emerged of the violent rape and murder of a student at the prestigious University of Cape Town, protesters massed at the gates of the convention center where the World Economic Forum was being held. Their ire over “gender-based” violence compounded the sense of tension smoldering elsewhere in the country, which has seen a resurgence of xenophobic attacks by local mobs on foreign migrants and shopkeepers.

South African President Cyril Ramaphosa had to break away from the forum’s proceedings to address the protesters’ concerns in a session of Parliament. But he returned the next day to extol the virtues of a potentially monumental African free-trade pact, stitched together over more than a year of diplomatic effort to little fanfare elsewhere in the world. The optimism of the World Economic Forum would not be dimmed by the unease outside its halls.

The deal is “going to be the greatest opportunity for economies on the continent to generate growth through trade,” Ramaphosa said.

On paper, that seems true. After Nigeria signed on to the African Continental Free Trade Area on the sidelines of the African Union summit in July, investors, wonks and politicians all started to dream of what may follow: a $3.4 trillion economic zone of some 1.3 billion people. In a report earlier this year, the International Monetary Fund dubbed the free-trade deal a “game changer” if African governments are able to bring down tariffs and boost trade within the continent.

A deal that ushers in a successful, more integrated Africa would make the region a “food basket to the rest of the world,” present a “huge consumer base” attractive to global investors, stem migration flows to Europe and help bring political stability to parts of the continent, said Saif Malik, head of Africa banking for Standard Chartered.

It also would buck a global trend. “With all the trade tensions that are going on between the U.S. and China, Africa is trying to find its own homegrown solution,” Malik told Today’s WorldView.

That was a view shared widely in Cape Town this past week. “We need to all acknowledge and celebrate the fact that as the rest of the world is raising barriers and building walls, Africa has decided to embrace change,” Albert Zeufack, the World Bank’s chief Africa economist, said at a plenary session at the forum.

But Zeufack, Malik and many other experts offered plenty of cautionary notes, too. Major obstacles remain before a pact stitching together more than 50 disparate nations across a vast landmass could even start to look like anything resembling the European Union. Beyond the sizable political and bureaucratic hurdles standing between governments and the implementation of the deal, there are broader challenges vexing African economies.

By some calculations, the continent needs to generate a million jobs a month to satisfy the demands of a booming generation of young people desperate for employment — and to ensure that what could be a demographic dividend doesn’t become a dangerous liability. Africa needs an estimated $90 billion-100 billion a year in investment in infrastructure, including a huge expansion of its woeful power supply. And it needs to achieve all this while also reckoning with the ravages of climate change: As Africa’s energy and agricultural exports go up, it’ll remain the most vulnerable continent in the world to extreme weather patterns caused by global warming.

Analysts also warned that the free-trade deal may disproportionately benefit a few relatively rich nations with an existing industrial base, like South Africa, over smaller countries with less developed economies. Income gaps within the continent’s countries may also get exacerbated.

“We need to learn from trade in the era of globalization, trade that was inextricably linked to a race to the bottom on regulation. In an era without rules nor referees, the rich bullies took charge to take most of the spoils,” Winnie Byanyima, executive director of Oxfam International, told Today’s WorldView. “Richer countries, richer companies and richer people gained most from liberalized trade.”

Byanyima’s organization serves as the town crier at the World Economic Forum’s various annual events, warning the global jet-setting elites of the yawning divides their policies have created. A free-trade deal, Byanyima added, “will be great for Africa only if it reduces economic inequality and creates good quality jobs, especially for women and for our young people.”

So what’s to be done? Many of the African attendees at the forum expressed exasperation with the continent’s political elites. “The young people who are out there are extremely angry,” said Oby Ezekwesili, a prominent former Nigerian politician and civil society activist. She argued that the steady progress of a Pan-African trade pact meant little if political leaders didn’t confront the systemic problems within their societies. “We have a problem of bad politics on the continent.”

The conference’s solution for this is now familiar: A focus on the myriad innovative projects and business initiatives — from solar tech to micro-electricity grids to digital banking to companies that seed clouds with artificial rain — that are pushing the continent forward despite its laggard governments.

But geopolitics is never far away. A more integrated African market only raises the stakes for what some have dubbed a new “scramble” for Africa. China’s ever-expanding footprint on the continent has provoked frequent complaints of neocolonialism. But there’s also been a flurry of recent investment and engagement from India, Japan, Turkey and Brazil, as well as the major powers of the West. This, ultimately, may be a boon for Africa.

“When you talk about the word ‘scramble,’ it’s to make the assumption that people on the continent are uninvolved and uninterested,” said Frannie Léautier, Nairobi-based chief operating officer of the Trade and Development Bank. She argued that is far from the case now: “Africa is wiser. Africa is learning. Africa is choosing.”

Want smart analysis of the most important news in your inbox every weekday, along with other global reads, interesting ideas and opinions? Sign up for the Today’s WorldView newsletter.