JOHANNESBURG (Reuters) - A slump in commodity prices and flight by global investors from risky “frontier” markets has hammered currencies and state budgets across Africa, increasing dollar borrowing costs and raising the prospect of political instability.

A street trader counts out change for a customer in Durban, September 8, 2015. REUTERS/Rogan Ward

From Nigeria and Ghana in the west to Kenya in the east and South Africa and Zambia in the south, currencies have all fallen against the dollar, and in many cases crashed through historic lows plumbed in the 2008-09 financial crisis.

Things took a turn for the worse in mid-2014 when prices of oil and other commodities, the export mainstay of many African economies, dived largely due to a sharp slowdown in one of the biggest consuming countries, China.

This accelerated a flow of funds out of frontier markets, a less developed set of emerging markets, as investors anticipated a rise in U.S. interest rates which has yet to happen.

Although the decline in prices and prospects has been less precipitous than during the global crisis, the fallout from China could be even worse for Africa since state finances have failed to recover from the last upheaval.

African budgets were broadly in balance before the crisis but this year governments are on track for an average fiscal deficit of 4.2 percent of GDP, almost twice the shortfall in 2010, according to Barclays Africa.

As such, they have no scope to boost spending to counteract slowing growth. “The economic fundamentals of the region are much weaker than back in 2008, which makes riding this current storm so much more challenging,” said Barclays Africa regional economist Ridle Markus.

Africa’s growth era of the 2000s, fueled by high commodity prices, improved governance and the spread of technology such as the mobile phones, is fading fast. The IMF now predicts average sub-Saharan economic growth of 4.4 percent for 2015, down from the 5.8 percent forecast a year ago.

South Africa's rand ZAR=D3, Zambia's kwacha ZMW=, Uganda's shilling UGX=, Tanzania's shilling TZS= and Ghana's cedi GHS= have all set record lows in the last three months.

Nigeria, Africa's biggest economy and top oil producer, has limited the naira's NGN=D1 losses only by freezing its foreign exchange market, a move that cost it inclusion this week in an influential JP Morgan bond index.

RISING DEBT

More worryingly, government debt is climbing steeply, threatening another driver of growth: the debt forgiveness a decade ago which freed up funds for social and infrastructure investment, rather than interest payments.

Although domestic capital markets have been slowly deepening, much of the growth in borrowing has been in dollars as African governments tapped Eurobond markets awash with cash printed by the U.S. and European central banks.

Ghana, a Eurobond trailblazer in 2007, has issued two more dollar bonds since then. It has plans for another $1.5 billion issue this year, putting its public debt at around two thirds of annual gross domestic product - well above levels before Nelson Mandela and anti-poverty activists Bono and Bob Geldof persuaded the rich world to forgive Africa’s crushing debts.

Zambia, until recently Africa’s top copper producer, has also been piling into the Eurobond market, most recently in July when it had to pay a hefty 9.375 percent for a $1.25 billion bond earmarked to finance a yawning deficit.

With the kwacha down more than 20 percent since the bond was issued, the effective local cost of servicing that debt is now over 30 percent, squeezing out other spending in a budget already under pressure from the collapse in copper prices.

BAD HABITS

Elections are due in both Zambia and Ghana next year, raising suspicions that some African countries are slipping back into the bad old habits of borrowing to fund vanity projects and political ambition rather than long-term growth.

“There is a concern with a lot of the African dollar debt market,” said Anders Faergemann, senior sovereign portfolio manager at PineBridge Investments. “We have this return of original sin with potential for sharp devaluation in local currencies and the governments still having to pay back in dollars.”

With African populations growing faster than their economies can create jobs, analysts expect the squeeze on state spending to spill over into political unrest at some point.

New York-based DaMina Advisors has even developed an African “Commodity Price Collapse Instability Index” - nicknamed Hades - based on its estimate that 87 percent of African government revenues are directly or indirectly linked to commodities.

DaMina lists three states - South Sudan, Libya and Central African Republic - as being at “extremely” or “very” high risk of collapse, and a further five - Equatorial Guinea, Chad, Democratic Republic of Congo, Lesotho and Guinea - as high risk.