South Africa's ruling party on Monday chose Cyril Ramaphosa, a reformer who helped negotiate the end of apartheid, to succeed President Jacob Zuma as head of the African National Congress, putting him on track to become the country's next leader.

Ramaphosa was elected at a party conference here after the vote was delayed more than 24 hours to settle internal disputes. He defeated former government minister Nkosazana Dlamini-Zuma, who is Jacob Zuma's ex-wife.

Zuma's second five-year term as party president will end with the close of the convention Wednesday, but he will remain president of the country until 2019.

His years as president have been marked by rampant corruption that has left voters disenchanted with the ANC.

Ramaphosa now faces the task of winning back the support of voters. Twenty-three years after the country held its first all-race election, which the ANC won with Nelson Mandela at the helm, more than one in two South Africans live in poverty. The country suffers from an unemployment rate of nearly 30 percent.

Cyril Ramaphosa is the newly elected president of the African National Congress. (Waldo Swiegers/Bloomberg)

Systemic corruption prompted two ratings agencies to downgrade the country, Africa's most industrialized, to junk status.

Ramaphosa captured a majority of the 4,708 votes cast at the convention, and although he is seen as a reformer in the party, it amounts to a "Pyrrhic victory," said analyst Richard Calland, because the ANC remains divided.

"The candidate lost, but the faction won," Calland said of Dlamini-Zuma. Three of the party's top six positions went to Dlamini-Zuma's allies, who will cater to the party's rural base instead of trying to court the urban middle class.

"That's an extraordinary paradox," Calland said. "But it makes sense, because she was the wrong candidate for this faction. She was a misfit."

The ANC has seen its share of the electorate fall in each of the past three elections. In 2016, it lost control of Johannesburg; Tshwane, which includes the capital, Pretoria; and Nelson Mandela Bay. Those three cities are run by coalitions led by the Democratic Alliance. The alliance rules Cape Town and the surrounding Western Cape province outright.

ANC members celebrate after Ramaphosa is elected president of the party in Johannesburg on Monday. (Siphiwe Sibeko/Reuters)

The opposition party plans to target Gauteng province, which includes Pretoria, and Johannesburg, the economic hub of southern Africa, in the 2019 elections. That would firmly cement the Democratic Alliance as the party of the urban centers.

Gwede Mantashe, the party's outgoing secretary general, who will stay on as national chairman, said the ANC will try to regain the cities it lost last year.

"We don't want to be relegated to a rural party," he said.

Ramaphosa founded the National Union of Mineworkers and led the union through strikes that shook the apartheid-era economy. He helped negotiate the end of apartheid on behalf of the ANC and was Mandela's chosen successor to lead the party.

When he lost his chance to become ANC president in the 1990s, Ramaphosa embarked on a lucrative career in the private sector and amassed a fortune that made him one of the country's wealthiest people. His Shanduka Group, a holding company, invested in the mining sector. He divested from the company and stepped down from various corporate boards three years ago.

Ramaphosa campaigned on anti-corruption promises.

Dlamini-Zuma served as health minister in Mandela's government and later as foreign affairs minister and chairwoman of the African Union Commission in Addis Ababa, Ethiopia. In her campaign, she promised to tackle racial inequality and called for a redistribution of wealth to the black majority.

She would have been hampered in a general election in 2019 in part because of her name: She and Jacob Zuma have four children and divorced in 1998.

Jacob Zuma told reporters before the results were announced that he was "bowing out happy" and was comfortable with his contribution to the ANC and South Africa.