ORANGE lights flash in the setting sun as Chinese workers lay train tracks on the dry edge of Tsavo national park in Kenya, lowering a 25-metre steel rail into place as gingerly as a dental filling. The men fret, with good reason: safety rules may protect them against falling sleepers but the African bush adheres to no regulations. Few workers dare to venture out of their sheet-metal camps at night for fear of big cats on the prowl: in January a watchman was mauled by a cheetah.

China Road and Bridge Corporation, the main contractor, has set up shop in territory made famous by the so-called man-eaters of Tsavo. When British colonial officials first built a railway line here in 1898, a notorious pair of maneless male lions killed about 30 mainly Indian labourers. “Perhaps we should have known better,” says Lao Ding, a shift supervisor.

The challenges of upgrading and expanding Africa’s transport network are manifold—but so are the rewards. The Kenyan government claims its new railway will boost economic growth by 1.5 percentage points annually, not least because it will reduce the costs of moving freight by 60%. The initial 609km (378-mile) section from the port in Mombasa to the capital, Nairobi, was started last month and is expected to be completed in 2017. It will then be continued inland to Congo, replacing a narrow-gauge track built a century ago.

Across the continent improved infrastructure of all sorts may increase economic growth by 2 percentage points a year, says the World Bank. The question many poor countries face, however, is whether to give priority to improving their roads or investing in other vital projects, such as hospitals, schools or power lines. Yet access to markets, schools and hospitals often depends on paved roads to distant towns and cities.

Improving transport is particularly pressing because the cost of moving goods in Africa is, on average, two or three times higher than in developed countries, according to the World Bank. And roads that are unsafe may be little better than none at all. Crashes on Uganda’s crumbling roads, for instance, are reckoned to cost it 2.7.% of GDP a year through lost lives and damage to property, the bank says.

Sub-Saharan Africa spends some $6.8 billion a year on paving roads, but it needs to spend closer to $10 billion. Fortunately decades of underinvestment are being reversed and money is now flooding into roads, railways and ports.

The continent’s road network has grown by an average of 7,500km a year over the past decade, a sharp increase from previous decades. Among those pouring tar fastest were Tanzania and Lesotho, with annual increases of about 15% and 24% respectively, according to the African Development Bank (ADB).

In 2016 a paved trunk road will connect Cairo and Cape Town for the first time when the last section, in northern Kenya, is finished. That will be almost exactly 100 years after the first effort to drive along this route ended tragically in 1914, when Captain Kelsey, a British officer, was killed by a leopard in what is today Zambia.

Other road links are improving, too. The Trans-Sahara Highway from Algiers to Lagos is 85% complete and may be finished this year. Almost wherever one travels in Africa, one finds road-building crews.

Dilapidated railways are also being refurbished and new ones laid. The Mombasa-Nairobi line is but one of three new rail corridors on the drawing boards in east Africa. The other two are intended to connect Lamu on Kenya’s coast to South Sudan and Ethiopia; and Dar es Salaam in Tanzania to Rwanda and Burundi (see map).

The money for all this comes not just from national budgets or aid agencies, the usual sources, but also from private investors and new lenders. Chief among them is China, which recently signed a deal with the African Union that envisions a network of high-speed railways to link all countries on the African continent in the next few decades. Several African countries have tapped international capital markets with debut bond issues in recent years. Zambia, which sold its first dollar-denominated bond in 2012, has since returned with more, in part to fund an ambitious transport plan that now consumes more than $1 billion a year, a seventh of its budget. African governments last year raised $8 billion in global sovereign bonds, up from $1 billion a decade ago. They are helped by a hunger for yield by investors in the rich world, where interest rates are being held down by central banks. The private sector is also putting money directly into projects, as governments sell off state firms or grant concessions for railways. Since 2009 Qalaa Holdings, an Egyptian firm, has invested $234m in refurbishing railways in Kenya and Uganda after their governments granted a 25-year concession to run the railways. Cities including Dakar (Senegal) and Abidjan (Ivory Coast) have introduced tolls for highways and bridges.

Among the biggest commercial investors is Angola’s sovereign-wealth fund, which recently set up a dedicated $1.1 billion infrastructure fund. “Transport infrastructure has the potential to generate a high yield,” says its head, José Dos Santos. “We see returns above 10% per year on a ten-year investment horizon.”

A recent glut of mining projects, caused by high commodity prices (a few years ago), is also leaving its mark. The government of Guinea, for instance, has made a deal with a consortium led by Rio Tinto that is exploiting the Simandou iron-ore field to make its dedicated rail and port infrastructure available to multiple parties on an “open access” basis. That could set a precedent for the way in which other governments deal with mining firms.

Still, risks abound. Countries that had spent much of the 2000s paying down debt and running prudent budgets are going back into the red. Outstanding debt by African states hit a ten-year high of 35% of GDP last year, says the IMF. It reckons that fiscal deficits in sub-Saharan Africa were, on average, 3.3% of GDP in 2014, a big shift from a surplus of 2.5% a decade ago.

Governments are also at the mercy of commodity prices. Exports of natural resources not only provide much of their revenue but have also spurred a good deal of private investment. When commodity prices go down, as they have done recently, building of roads and railways often stops.

Just as important as new roads are accompanying reforms. Cutting the time customs officers take to clear cargoes can yield benefits as great as those from expensive new roads. “Building more isn’t always the answer,” says Henry Des Longchamps at the World Bank. “Political leaders are often under pressure to deliver what turn out to be white elephants.”