By Olivia Kumwenda-Mtambo and Alexander Winning
JOHANNESBURG (Reuters) - South Africa's ANC began counting ballots on Monday to determine who will lead the party which has ruled since the end of apartheid but is tarnished by scandals and allegations of corruption.
The vote is perhaps the most pivotal moment for the deeply divided African National Congress since it launched black-majority rule under Nelson Mandela's leadership 23 years ago.
Whoever emerges at the helm of the ANC, a 105-year-old liberation movement that dominates Africa's most industrialised economy, is likely to become the country's next president after elections in 2019.
Senior party members drew battle lines on social media, backing either Deputy President Cyril Ramaphosa or Nkosazana Dlamini-Zuma - a former cabinet minister and the ex-wife of President Jacob Zuma - who are contesting the leadership.
A total of 4,776 delegates were eligible to cast their ballots in a vote that began in the early hours of Monday.
"It is going to be very close," a senior ANC source said. "Both camps have spreadsheets where they have calculated the number of delegates on their side. Both sides have different assumptions and guesswork."
Ramaphosa, a former trade union leader who became a businessman and is now one of the richest people in South Africa, has vowed to fight corruption and revitalise the economy, a message hailed by foreign investors.
Dlamini-Zuma - the current president's preferred candidate - has pledged to tackle the racial inequality that has persisted since the end of white-minority rule.
They were the only candidates nominated for the ANC leadership at a conference in Johannesburg on Sunday night.
ANC spokesman Zizi Kodwa said all the provinces had finished voting, except for a few stragglers who were winding up.
"When we are done with those people, counting will proceed manually. We are hopeful that by late afternoon or early evening we should be able to get the results."
The party's Chief Whip Jackson Mthembu announced on Twitter that he voted for Ramaphosa, while police minister Fikile Mbalula tweeted that he had cast his vote for Dlamini-Zuma.
Zweli Mkhize, the outgoing ANC treasurer general, said he had yet to vote but still planned to do so. He declined to say whom he backed but added that he had "absolute confidence" the delegates would make a good choice for the party's leadership.
In a boost to Ramaphosa, courts ruled that officials from some provinces seen as supporting Dlamini-Zuma had been elected illegally and were barred from the conference.
The rand currency <ZAR=D3> rose on Monday and government bonds firmed on hopes Ramaphosa would win the race. [nL8N1OI1WM].
"The rand is considerably stronger than where it was last week," said IG Markets currency strategist Shaun Murison. "I think a Cyril Ramaphosa win is priced in."
Ramaphosa drew the majority of nominations from party branches scattered across the country. But the complexity of the leadership race means it is far from certain he will win when the votes are finally counted.
For one, delegates are not bound by their branches when they vote at the conference.
Lukhona Mnguni, Political analyst at University of KwaZulu-Natal, said the outcome of the ANC leadership contest was likely to be a managed arrangement, with discussions behind the scenes.
"This idea that the power is in the branches is a ruse by leaders to hoodwink society into thinking they are impartial and make branches think they have control over their own destiny," Mnguni said.
On Saturday, Zuma announced plans to raise subsidies for tertiary colleges and universities, a move analysts said was timed to appeal to the party's more populist members allied to Dlamini-Zuma, the first woman nominated as an ANC presidential candidate.
Zuma has faced allegations of corruption since he became head of state in 2009 but has denied any wrongdoing.
His performance as head of the party has caused sharp rifts, represented by those who back him in the Dlamini-Zuma faction and those who see Ramaphosa as providing an alternative.
"The race is extremely close," said Susan Booysen, a political analyst at the University of Witwatersrand's School of Governance in Johannesburg.
"Before today we said Dlamini-Zuma could emerge as a winner. Even if there is a strong lead in terms of branch nominations by the Ramaphosa camp, it's not clear-cut."
(Additional reporting by James Macharia, Alexander Winning, Zandi Shabalala, Nqobile Dludla and Mfuneko Toyana; Writing by James Macharia; Editing by Toby Chopra)