The result was expected later Monday, though it was unclear how long counting would take
South Africa's ANC votes on new leader in all-night ballot
Thousands of delegates from South Africa's ruling ANC party cast secret ballots throughout the night Monday to choose their next leader after repeated delays to a ballot seen as a decisive moment in the country's post-apartheid history.
The only two candidates in the tight race are deputy president Cyril Ramaphosa, a wealthy businessman, and former minister Nkosazana Dlamini-Zuma, who is president Jacob Zuma's ex-wife.
One of those two would be well placed to be the country's next president in 2019 elections.
Voting started soon after midnight on Sunday and continued into the morning after repeated delays due to disputes over which delegates were qualified to vote, with hundreds of attendees banned from the poll.
By Monday morning, most of the 4,776 delegates had cast their ballots.
The result was expected later Monday, though it was unclear how long counting would take.
ANC spokesman Khusela Sangoni told reporters that the process was "proceeding smoothly".
On Sunday, rival supporters sang and chanted in the conference hall outside Johannesburg as the vote was repeatedly pushed back due to disputes over delegates' credentials.
"I have not slept for the past 24 hours, but I don't care," said Patience Nomodi, 62, a party member for 40 years, wearing an ANC blanket on her shoulders and walking with a yellow walking stick.
"I want a woman to be president before I die."
Ramaphosa-supporting delegate Siya Kolase told AFP after voting early on Monday that he was confident his candidate would emerge victorious.
"He will address the issue of corruption. He is going to stabilise our economy," Mr Kolase said.
With public support for the ANC falling, the party that has ruled since 1994 when Nelson Mandela won the first multi-racial vote could struggle to retain its grip on power in the 2019 general election.
Mr Zuma, whose rule has been marred by graft scandals, will step down as ANC chief at the meeting but will remain as head of state ahead of the 2019 vote.
In his farewell address, Mr Zuma appealed for unity in a party riven by bitter factions, and blamed the decline in the ANC's popularity on "perceptions in society that we are soft on corruption, self-serving and arrogant".
"Petty squabbling … needs to take a back seat," he said.
"Our people are frustrated when we spend more time fighting among ourselves instead of solving the daily challenges they experience."
Mr Zuma is seen as backing Ms Dlamini-Zuma, who may protect him from prosecution over graft charges.
Some analysts say the contentious leadership battle could end up splitting the party.
The ANC is still South Africa's biggest party by far, but the 54 per cent it won in local elections last year was its worst poll result since 1994.
In opposition, the Democratic Alliance and the Economic Freedom Fighters are hoping to exploit the ANC's woes in the 2019 election, with one possible outcome being a coalition government.
Soaring unemployment and state corruption have fuelled frustration at the ANC among millions of poor black South Africans who face dire housing, inadequate education and continuing racial inequality.
Ms Dlamini-Zuma, 68, headed the African Union commission until earlier this year and is a former interior, foreign affairs and health minister.
Her critics have warned she will pursue Mr Zuma's failing economic and political policies.
The couple had four children together before divorcing in 1998.
Mr Ramaphosa, 65, a former trade union leader, led the historic negotiations in the 1990s to end apartheid before launching a business career that made him one of the country's wealthiest men.
He is often accused of failing to confront Mr Zuma while serving as his deputy since 2014.
Ben Payton, an analyst at the global risk consultancy Verisk Maplecroft, said Mr Ramaphosa was well-positioned for victory but Ms Dlamini-Zuma "remains within touching distance of an upset win".
"The conference provides an opportunity for the party to change direction after eight years in which the economy has flatlined, increasingly extreme rhetoric has scared off investors, and corruption has overwhelmed public finances," he said.