Jacob Zuma has resigned as President of South Africa, heeding orders by the ruling African National Congress (ANC) to bring an end to his nine scandal-plagued years in power.
In a 30-minute address to the nation on Wednesday night - during most of which it was not clear what his intentions were - the 75-year-old said he disagreed with the way the ANC had shoved him towards an early exit after the election of Cyril Ramaphosa as party president in December.
However, he added, he would accept the ANC's orders. "I have therefore come to the decision to resign as president of the republic with immediate effect," Zuma said. "Even though I disagree with the decision of the leadership of my organisation, I have always been a disciplined member of the ANC."
Zuma, who has been in power since 2009, faces many allegations of corruption. He has been under increasing pressure to give way to Ramaphosa.
"No life should be lost in my name. And also the ANC should not be divided in my name," he added.
Earlier in the day the ANC told Jacob Zuma to resign or face a vote of no confidence in parliament on Thursday.
The president's resignation as head of state brings certainty to a country gripped by a political drama for weeks, a senior ANC official said.
"This decision provides certainty to the people of South Africa at a time when economic and social challenges to the country require an urgent and resolute response," said the party's Deputy Secretary General Jesse Duarte.
Earlier, Jacob Zuma ranted for an hour about the ill treatment he had received at the hands of the ANC, saying it was "unfair" the party had told him to quit as proper procedure had not been followed.
The ANC tweeted a statement, ackowledging "errors and mistakes that were committed", but paying tribute to the "outstanding contribution" Zuma had made, and the "pivotal role" he had played in the peaceful transition from apartheid to democracy.
The president was besieged by sleaze and corruption scandals throughout his nine years in power, polarising Nelson Mandela's "Rainbow Nation".
The 75-year-old, a former anti-apartheid resistance fighter, was the country's most controversial leader since the end of white minority rule in 1994 - with a decades-long history of entanglement in scandals.
He has come under fire over his ties to the Gupta family, whose members include three businessmen accused of using their friendship with him to amass wealth and influence government policy.
Earlier on Wednesday police raided the Guptas' home and the family business' holding company in Johannesburg.
State broadcaster SABC said one of the Gupta brothers had been arrested and a senior source in the judiciary said more arrests would be made.
The family, which moved to South Africa from India in the 1990s, has been accused of influence peddling and interfering with cabinet appointments, whilst Zuma and his political associates have been accused of milking the state for their own profit.
Jacob Zuma was acquitted of raping a family friend in 2006 and is still fighting nearly 800 counts of corruption over a government arms deal from the late 1990s when he was deputy president.
He was found to have violated the constitution for failing to repay public money used to renovate his homestead but has so far escaped with giving a half-apology. He eventually paid back mroe than half a million dollars.
South Africa's official opposition party the Democratic Alliance tweeted to say "we rejoice with all South Africans today as the long, painful decade of Zuma's presidency finally comes to an end".
Zuma, whose Zulu middle name Gedleyihlekisa means "the one who smiles as he hurts you", has cast a long shadow over South African politics for years.
During the apartheid era he was imprisoned for 10 years with Nelson Mandela on Robben Island. Later he went into exile before returning as white rule came to an end.
In power, his career has been written off by commentators on several occasions. But he has proved them wrong time after time, earning himself the nickname "the great survivor".
His biographer Ronnie Kasrils described Zuma as "driven by a lust for wealth and power".
He used skills honed as the ANC's intelligence chief during apartheid, silencing dissenting voices by promoting little-known officials who did his bidding to powerful positions in the security and intelligence portfolios.
Zuma ensured the top leadership of the ANC was controlled by loyalists who could thwart attempts to unseat him if necessary.
"The politics of patronage sustained Zuma," said Bantu Holomisa, an opposition leader and former ANC member. "All those who would have questioned him were rewarded with cabinet posts and ambassadorships abroad. Those who were deemed undesirable were ferreted out of the ANC."
'South Africa is broke'
Even last August, loyal lawmakers helped him defeat a no-confidence vote brought by the opposition. But six months later he was forced to resign.
In December, Cyril Ramaphosa defeated Zuma's preferred successor in the ANC leadership contest. Several prominent Zuma allies on the National Executive Committee switched their allegiances.
"Zuma's departure is nothing more than an opportunity for change," said Ralph Mathekga, political analyst and author. "government coffers have been ransacked and our state-owned enterprises are on their knees. South Africa is broke."
"It's us who got South Africa into this mess by electing Zuma to be president," Jackson Mthembu, ANC chief whip has said. "We should have looked closely into the man. With hindsight we made a terrible error of judgment."