CAPE TOWN — South Africa’s embattled president, Jacob Zuma, resigned on Wednesday, putting an end to a period of scandal and mismanagement that threatened to destroy the party of Nelson Mandela.

Zuma’s resignation leaves his deputy, Cyril Ramaphosa, as the country’s acting leader, and a man now charged with salvaging the legacy of Africa’s most famous liberation movement.

Zuma was once revered as a hero of that movement, who served as a political prisoner alongside Mandela in his youth. But Zuma’s nine years in power, marred by a string of corruption allegations, drove even party loyalists away from the once seemingly indefatigable African National Congress (ANC).

But to many here, the most destructive aspect of Zuma’s legacy was his failure to deliver on the promises of post-apartheid South Africa. Twenty-four years after Mandela rose to power, promising a rainbow nation of shared prosperity, South Africa remains one of the world’s most unequal countries, with many blacks living in conditions much like those they endured under the white nationalist government.

Under intense pressure from the ruling African National Congress party, Zuma said his decision was spurred by altercations that had taken place outside the party headquarters in Johannesburg in recent days.

“No life should be lost in my name, and also the ANC should never be divided in my name,” the 75-year-old head of state said in a televised statement in Pretoria.

“I have therefore come to the decision to resign as president of the republic with immediate effect, even though I disagree with the leadership of my organization,” he said. “I have always been a disciplined member of the ANC.”

The resignation came one day after ANC ordered him to step down or face a vote of no confidence in Parliament. It ends a long week of limbo for many South Africans as the ANC has tried to persuade Zuma to resign and renew South Africans’ faith in the party.

Zuma was South Africa’s fourth president since the end of apartheid, the harsh racial-segregation policy that stripped rights from the black majority. Born poor, Zuma taught himself to read and write and joined the anti-apartheid ANC at age 17.

He eventually became a member of its armed wing in 1962 and was part of a group of dozens of activists convicted of trying to overthrow the white-minority government. He served 10 years in the infamous Robben Island prison with Mandela and other ANC leaders.

To his critics, the president’s early departure — his term as head of state was not up until national elections next year — marks the end of a frustrating era in which the nation drifted and Zuma’s name became nearly synonymous with the use of the public office for personal gain.

Many South Africans hope Ramaphosa, should South Africa’s parliament elect him as the nation’s next president this week as expected, will put South Africa on a new path, taking on corruption and restoring the reputation of Africa’s oldest liberation movement.

In his statement, Zuma reiterated comments he made earlier in the day in a televised interview that he did not agree with his party’s decision to order him out of office, nor had he been told why he had to leave.

“I do not fear exiting political office,” he said. “However I have only asked my party to articulate my transgressions and the reason for its immediate instruction that I vacate office.”

Despite announcing their decision to recall Zuma on Tuesday, ANC officials have been reticent about why they think he should resign, in an apparent reluctance to broach the matter of the numerous corruption scandals he has been embroiled in.

During the interview, Zuma stated repeatedly that he did not agree with his party’s decision to order him out of office before his term is up next year, saying it was not in keeping with party’s tradition. He warned that infighting among leaders in the governing party could end in violence on the streets between ANC supporters who disagree with one another.

“The manner in which you remove the president is a very serious matter . . . you don’t force people,” Zuma said. “I think we are being plunged in a crisis that I’m sure my comrades, my leaders will regret. Some people may not like this, may feel something is wrong.”

As he spoke, a clock in the corner of the television screen on the eNCA news channel counted down the hours, minutes and seconds to the deadline the party has given him to resign.

The stunning standoff between Zuma and his party is the culmination of a long-simmering battle over the leader’s future after nearly a decade in power. Increasingly, Zuma has been pummeled by graft scandals and complaints about the government’s inability to turn around a sagging economy.

“The ball is in [Zuma’s] court,” Paul Mashatile, the ANC’s treasurer general, said at a briefing after the party meeting. “We can’t wait. It’s not fair to South Africans, not fair to the ANC, not fair to anybody. Everything has come to a standstill. We need to be able to move.”

Party officials said Wednesday that the ANC wanted to act quickly to vote Ramaphosa in as president and have him deliver the State of the Nation address Friday.

“We cannot continue to be in a state of limbo,” ANC Chief Whip Jackson Mthembu said. “We need to get Ramaphosa elected as president and everything will flow from there.”

For years, Zuma has outmaneuvered his detractors, and ANC parliamentarians have backed their leader in votes to unseat him in parliament.

But support for Zuma has eroded since Ramaphosa replaced him as party leader in December.

Even longtime allies who staunchly supported Zuma for years also demanded that he step down. Early Wednesday, an elite police unit raided a Johannesburg compound belonging to the wealthy Gupta family, accused of colluding with Zuma. The raid was interpreted by some as a warning for Zuma to act soon.