CAPE TOWN, South Africa — South African President Thabo Mbeki told the nation Sunday that he had resigned, relinquishing the leadership of the continent's powerhouse to bitter rivals who hounded him out of office after nine years at the top.

In a televised speech focusing on the successes and shortcomings of his presidency, Mbeki said he had handed a letter of resignation to the speaker of Parliament, Baleka Mbete. He said he would step down at a date to be determined by the National Assembly.

Parliament will convene in the coming days to select an interim president to serve until elections, which are scheduled for next year. Mbete — who is also chairwoman of the African National Congress, the ruling party — is widely tipped to become a temporary head of state, paving the way for Mbeki's nemesis, Jacob Zuma, to take over after the elections.

Mbeki, 66, lost the final battle Saturday in a long-running struggle against Zuma, his former deputy. He came under pressure to quit after a judge threw out a corruption case against Zuma earlier this month and implied that Mbeki's administration had put political pressure on prosecutors.

Mbeki said "categorically" he had never interfered in the work of prosecutors. He said that included "the painful matter" of the Zuma case.

Early indications were that most Cabinet ministers had agreed to stay, including Finance Minister Trevor Manuel, who is important to investor confidence in South Africa.

A senior ANC official, Matthews Phosa, said the party had asked the Cabinet to remain on the job.

"We want the Cabinet to stay," Phosa said. "We want stability and we want them to stay ... but we cannot enforce things upon them," he said on South African television.

Phosa also said the party wanted Mbeki to continue as mediator in Zimbabwe where he recently persuaded President Robert Mugabe to share power with the opposition.

Despite the public humiliation inflicted on him by his party, Mbeki was dignified and statesmanlike in the television address.

He thanked South Africans for letting him serve them — for five years as deputy president and nine as president — and said he would continue as a member of the ANC, to which he has belonged for 52 years.

He likened public office to a marathon of long roads, steep hills, loneliness and uncertain rewards at the end and urged South Africans to cherish the freedoms gained by many years of anti-apartheid struggle.

"We should never be despondent if the weather is bad, nor should we turn triumphant because the sun shines," he said.

Mbeki did not use the occasion — as some had feared — to lash out at his opponents. Instead, he voiced confidence that the next administration would build on his own achievements and tackle the many poverty-related problems facing South Africa.

He traced the achievements of his office, including transforming the economy "resulting in the longest period of sustained economic growth in the history of our country," making social progress and winning the right to host the 2010 World Cup.

"Despite the economic advances we have made, I would be first to say that ... the fruits of these positive results are still not fully and equally shared among our people, hence abject poverty coexisting side by side with extraordinary opulence."

He said much more needed to be done to combat the "twin challenges of crime and corruption."

In announcing Mbeki's ouster Saturday, ANC secretary-general Gwede Mantashe said that the party hoped to end its internal wrangling and focus on next year's elections. The ANC enjoys a huge majority and is expected to romp to victory. But there had been speculation that Mbeki loyalists might try to set up a rival party.

Mbeki — known in the past for his ruthlessness in ousting potential or actual opponents — had been on the losing end of a power-struggle to Zuma for months. He lost his bid for a third term as ANC President at the party's congress last December and the knives were out for him ever since.

Mbeki fired Zuma as his national deputy president in 2005, after Zuma's financial adviser Schabir Shaik was convicted of trying to elicit a bribe to deflect investigations into an arms deal.

Initial charges against Zuma were withdrawn, but the chief prosecutor said last December that he had enough evidence to bring new ones. That was within days of Zuma's election as ANC chief. Judge Chris Nicholson threw out the new charges last week and implied they were the result of political interference.

"I would like to state this categorically that we have never done this and never compromised the right of the National Prosecuting Authority to decide whom it wished to prosecute and not to prosecute. This applied equally to painful matter relating to court proceedings against the President of the ANC, Comrade Jacob Zuma," he said.