South Africa's embattled President Jacob Zuma has resigned after intense pressure from his own party.
In a televised statement he said he was quitting with immediate effect but said he disagreed with his ANC party's decision.
The ANC had told him to step down or face a vote of no confidence in parliament.
The 75-year-old has been facing calls to give way to Deputy President Cyril Ramaphosa, the ANC's new leader.
Mr Zuma, who has been in power since 2009, faces numerous allegations of corruption.
Earlier on Wednesday, police swooped on the Johannesburg home of the powerful and wealthy Gupta family with whom Mr Zuma has close ties.
He began his speech by laughing and joking with members of the press, asking them why they looked so serious.
After paying tribute to those whom he had worked with over the years, Mr Zuma said that violence and division within the ANC had influenced his decision to step down.
"No life should be lost in my name and also the ANC should never be divided in my name. I have therefore come to the decision to resign as president of the republic with immediate effect," he said.
"Even though I disagree with the decision of the leadership of my organisation, I have always been a disciplined member of the ANC.
"As I leave I will continue to serve the people of South Africa as well as the ANC, the organisation I have served...all of my life."
Mr Zuma, a former member of the ANC's military wing in the days of apartheid, rose through the ranks of the party to become president. He led the country for more than a third of its time after apartheid.
But he leaves office with several scandals hanging over him, and with South Africa's economy in dire straits.
A meeting of the ANC's National Executive Committee had announced its decision to recall Mr Zuma on Tuesday and gave him until the end of Wednesday to resign.
ANC chief whip Jackson Mthembu then announced a parliamentary motion of no-confidence for Thursday, with Mr Ramaphosa sworn in as president as soon as possible after that.
Mr Zuma's resignation capped a day of fast-moving events.
As deputy president, as well as ANC leader, Mr Ramaphosa is likely to step in.
But it is thought that he would not seek to remain as president, preferring to get his own mandate at next year's presidential elections.
The ANC, as the party in government, would then nominate a candidate to serve until then, and parliament would take a vote within 30 days.
Mr Ramaphosa was already the overwhelming favourite to win the 2019 election, one which Mr Zuma was barred from competing in, having served two terms, reports BBC.