Minutes after South African President Jacob Zuma narrowly escaped a no-confidence vote this week, he was singing and dancing outside parliament with a throng of supporters from his African National Congress party.

That celebratory mood faded fast. Though Zuma survived the most serious attempt yet on his leadership, allegations of corruption and poor governance have significantly weakened the ANC, the once potent party of Nelson Mandela, observers say.

The ANC, instrumental in ending South Africa's apartheid regime of racial discrimination, has ruled since the country's first all-race elections in 1994. But its support has eroded since Zuma came to power in 2009 as South Africans have vented their frustration at the ballot box over high unemployment and a lack of basic services like water and electricity.

In a striking sign of dissent within the party, more than 25 ANC members supported the opposition's move this week to vote out Zuma or didn't show up to vote. Of the 384 votes cast in an unprecedented secret ballot, 177 were in favor of unseating Zuma and 198 were against, with nine abstentions.

That public display of internal rebellion also highlights the party's bruising battle to succeed Zuma, who will step down as ANC leader in December. A steady stream of ANC members and anti-apartheid veterans have publicly urged Zuma to step aside before then, as anger grows among voters over scandals that included millions of dollars of public money spent on Zuma's private home.

Zuma will have more damaging moments in the coming months, with courts set to hear a bid by the opposition Economic Freedom Fighters party to impeach him, as well as Zuma's own appeal to drop nearly 800 charges of alleged corruption, racketeering and fraud against him.

The developments have chipped away at the ANC's decades-old moral authority, while "pro" and "anti" Zuma factions within the party fight for control and prepare for the 2019 national elections.

"The ANC works on the assumption it can pull together a credible campaign in the future, and that the core of the ANC is still there," said Susan Booysen, a professor of politics at the University of Witwatersrand.

That's not a certainty, she said. "The ANC is really, really in a deep crisis."

The ANC's vote share dropped from nearly 70 percent in the 2004 national elections to just over 62 percent in 2014. The party had its worst-ever showing in the August 2016 local elections, losing control for the first time of the commercial hub of Johannesburg, capital Pretoria and Port Elizabeth.

That prompted party leaders to declare they would "introspect" to understand why voters are turning their backs on the party. In the parliament debate before this week's no-confidence vote, at least one young member warned that South Africa's upcoming generation of voters would look elsewhere.

Instead of pursuing reforms, the party has been embroiled in the Zuma administration's challenges. Those include growing accusations that Zuma and his allies have granted political favors to a wealthy family of Indian immigrants, the Guptas, while Zuma's related decision to fire his respected finance minister in March prompted two major ratings agencies to downgrade the country's credit rating to junk. The Guptas have denied any wrongdoing.

"The ANC has done nothing since the last local elections to help themselves," said Daniel Silke, director of the Political Futures Consultancy in Cape Town. "In fact, their position has deteriorated substantially. They've gone backwards since 2016."

Opposition parties have capitalized on that slide, seeking to put the ANC's deepening fractures in the national spotlight through moves like the no-confidence motion.

On Thursday, the Democratic Alliance, the main opposition party that initiated the no-confidence motion, submitted a fresh motion to dissolve parliament. If the motion passes, it would force early elections. Given the ANC's majority in the house the measure is likely to fail, but it provides the opposition with another chance to build its case that the ANC has lost touch with voters.

The ANC can still rely on substantial support, particularly in South Africa's rural areas, and cannot be counted out.

"The ANC remains a powerful brand," analyst Silke said. Though the opposition has gained, no party appears strong enough to unseat it, he said. However, "the ANC can damage themselves."