Johannesburg - President Cyril Ramaphosa may be on course to retain power in Wednesday's election, but he will face the immediate challenge of fixing a floundering economy that is stoking public unrest.
While the country is the continent's most industrialised economy with its most developed infrastructure, it is grappling with stagnating growth and unemployment levels creeping towards 30 percent -- rising over 50 percent among the young.
Rampant corruption, ballooning national debt and depressed investor confidence have weighed down the potential of the country under the ANC, which has ruled since the end of apartheid and is widely tipped to win again, polling at more than 50 percent of the vote.
Its closest challenger, the opposition Democratic Alliance, is forecast to get only about 20 percent.
After May 8, the president -- likely to be incumbent Cyril Ramaphosa as ANC leader -- will have a tough task creating jobs, attracting foreign money and tackling corruption.
Soaring fuel prices, a weak local currency and persistent inequalities further add to the socio-economic malaise.
"Persistently low growth and high unemployment rates are key economic challenges," according to global investment ratings agency Moody's.
South Africa's economy grew at less than one percent last year and slipped into a brief recession during the third quarter of 2018.
Discontent at poor basic services such as water, housing and electricity have sparked a wave of protests, with violent crime further fuelling public anger.
Strong business support
Ramaphosa, who enjoys support from the business community, has prioritised reform and economic revival.
But he faces resistance from within his own party from factional ANC rivals who may work to scupper his agenda.
His efforts to dismantle well-organised corruption networks that flourished under predecessor Jacob Zuma will be resisted by some in the ANC, analysts say.
"Business has put a lot of resources behind him, to support him to succeed but he's going to have severe political constraints because his party is divided between the good people and the bad people," said Lumkile Mondi, a senior lecturer at the University of the Witwatersrand in Johannesburg.
"Any action against those people that were involved in corruption and malfeasance is going to be politicised, limiting his ability," said Mondi.
Ramaphosa will have to take bold steps to deal with those caught in the graft web and reduce corruption which has become normalised, boosted by poor policing and a weakened justice system.
"It's no exaggeration to say Ramaphosa is caught between a rock and a hard place," Indigo Ellis, of London-based Verisk Maplecroft risk consultants, told AFP.
His "ability to achieve key targets, such as his promise of US$100-billion (foreign) investment in five years, depends on his capacity to maintain primacy... within the ANC," said Ellis.
South Africa was a prime investment destination in Africa after the downfall of apartheid, but under Zuma's presidency between 2009 and 2018, investor confidence fell to its lowest levels since white-minority rule ended.
In 2017, two of the world's leading ratings agencies S&P Global and Fitch downgraded the country to sub-investment levels.
Land reform gamble
One government policy particularly viewed with suspicion is the expropriation of white-owned land without compensation to be redistributed to poor, black people.
The plan has spooked investors and analysts say the new president must tread carefully to assure protection of property rights and attract investment.
The ANC, which has steadily been shedding support in recent years, but is still the majority party by quite a margin, has to win by a decent margin for Ramaphosa to have a strong mandate.
A confident Ramaphosa told the final ANC election rally Sunday he has taken "decisive steps to fight corruption" which has severely damaged state companies such as debt-laden power-supplier Eskom, which has had to impose highly-unpopular power rationing on companies and individuals.
"We've done much to restore the credibility and effectiveness of lots of institutions that have been weakened," he said.
"We are determined that those found guilty of corruption, will not be allowed to occupy positions of responsibility either in the ANC, in parliament or in government."
But wholesale reform of state companies such as Eskom would also likely mean mass redundancies and potentially violent labour unrest -- highlighting the balancing act the next president will have to perform.