Jacob Zuma has resigned as president of South Africa with immediate effect, state television announced Wednesday night.
Mr. Zuma, 75, has led South Africa since 2009.
His resignation came a day after he was rejected by his party, the African National Congress, on corruption allegations and his connection to the Gupta family in South Africa.
The party also gave Mr. Zuma until Wednesday night to resign or a vote of no confidence motion would be brought against him on Thursday to remove him from office.
Mr. Zuma is likely to be succeeded by Deputy President Cyril Ramaphosa, who has already emerged the new leader of the ANC.
Mr. Zuma had earlier refused to stand down during an interview with SABC even after police raided the homes of his associates, the Gupta family, in Johannesburg, the country’s commercial capital.
The Guptas, who have been named in a series of corruption probes, are said to be associates of Mr. Zuma, who has led South Africa since 2009.
Some members of the ANC have long asked Mr. Zuma to step down, and the party itself formally took a position on the matter by removing Mr. Zuma as its leader on Tuesday and asking him to resign within 24 hours.
The party’s Treasurer-General, Paul Mashatile, said on Wednesday that the party is starting “a new era.”
“The conference of ANC has created new hope. Our people want to see change. We want to go with renewal,” Mr. Mashatile said.
Since Mr. Zuma has now stepped down, it is unlikely that his cabinet would be forced to go with him. Mr. Mashatile had earlier said the cabinet members would be removed if Mr. Zuma failed to resign before the no-confidence vote on Thursday.
During his appearance on SABC Wednesday afternoon, Mr. Zuma denied all allegations of wrongdoing levelled against him and vowed not to resign.
He demanded that he should be told whatever his offences might be and he would take a decision on his future accordingly.
“No, I will not resign,” he said.
The ANC said parliament could elect another president as soon as Thursday if Mr. Zuma agrees to step down.
But on Wednesday night, Mr. Zuma announced his resignation, consequently preempting the no-confidence moves by his party.
Mr. Zuma had survived eight previous attempts to remove him. The failed efforts were largely driven by opposition politicians.
Mr Zuma said he stepped down to avoid violence and further division within the ANC.
“No life should be lost in my name and also the ANC should never be divided in my name,” Mr. Zuma said. “I have therefore come to the decision to resign as president of the republic with immediate effect.”
“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,” he added.
The ANC issued a statement saying Mr Zuma’s resignation provided “certainty to the people of South Africa”.
Mr. Zuma played a prominent role in the military wing of the ANC during the days of apartheid, and eventually replaced Thabo Mbeki in 2009.
The South African economy struggled under his tenure, and violent crimes also rose. But Mr. Zuma maintained that he helped deepen the country’s political and economic stability.