South African President Jacob Zuma's resignation Wednesday marks a dramatic end to a political reign that was mired in scandal and tainted by a worsening economy.
Until this week, the wily Zuma, 75, who never had much of a formal education, managed to outsmart his political opponents both inside the ruling African National Congress (ANC) and outside it.
During the years of struggle against apartheid that finally ended in 1991, Zuma was the head of the party's intelligence wing. The skills he gained during that time helped carry him to power in the country's new democratic era, but he has been dogged by criminal investigations for decades.
Even in his last days in office, Zuma remained the political survivor that he has always been. Refusing to resign when pressured by the ANC's top six leaders, he then bought time by negotiating directly with Cyril Ramaphosa, his presumed successor and leader of the party.
In the end, though, it was the ANC itself that had had enough, recalling Zuma from his position Tuesday following a marathon meeting of the party's executive committee, and urging the President to quit.
Zuma was born in Nkandla in rural KwaZulu-Natal, to a policeman and a domestic worker. He joined the ANC and South African Communist Party at a young age.
Arrested by the apartheid government in 1963, he was sentenced to 10 years on Robben Island, the windswept penal colony that also then housed the country's first black president, Nelson Mandela.
After his release, Zuma played a major role in organizing the liberation movement from exile in Mozambique and later Zambia. He took on key government positions after the transition to democracy.
Charges of corruption
It was in those heady early days of the new South Africa that Zuma became embroiled in what would be the first of many scandals.
His financial adviser, Schabir Shaik, was convicted of corruption relating to a large-scale arms deal in the late 1990s -- placing Zuma under increasing political and legal pressure.
In 2004, then-President Thabo Mbeki fired Zuma as deputy president and he was charged with corruption.
After many years of unresolved legal battles, Zuma still faces 783 charges of corruption, fraud and racketeering.
He denies all of them, and has become known as the "Teflon President" because few politicians could have survived the scandals he has faced and weathered -- until now.
Accusations of improprieties that dogged his presidency were not just of a financial nature.
In 2005, Zuma, who has several wives and more than 20 children, was charged with raping a 31-year-old HIV-positive woman in his home. The ensuing trial and media circus led many to believe that Zuma's political career was over.
He incited widespread ridicule in South Africa for saying he knew the alleged victim was HIV-positive, but did not fear contracting the illness because he took a shower after the sex. But in 2006, a court believed his account that the sex was consensual, and Zuma was acquitted of rape.
When he was still Deputy President, Zuma helped orchestrate a putsch against then-President Mbeki. At the end of 2007, he beat Mbeki to become the ANC leader. Zuma became President following elections in 2009, and was re-elected in 2014.
Scandal: Zuma's main legacy
Before the global financial meltdown, Zuma presided over an ebullient South African economy and wildly successful soccer World Cup in 2010. He has been praised by many for reversing Mbeki's AIDS denialism and leading a massive rollout of life-saving antiretroviral drugs.
He also helped shepherd South Africa through the death and funeral of Nelson Mandela.
But the passing of Mandela in 2013 perhaps drew out the deep flaws of the country's current President, and it is scandal that will be the main legacy of Zuma.
In 2016, South Africa's top court ruled that Zuma had acted unconstitutionally when he used $15 million in public funds to upgrade his private home in Nkandla, and ordered him to repay some of the money. He still also faces the hundreds of allegations of corruption relating to the 1990s arms deal.
Zuma still denies the corruption allegations against him. And despite street protests, opposition maneuvering, and defections from his own party, he refused to step down.
For a politician always skilled at working behind the scenes and in the trenches, it was his own party leaders who finally turned their backs on him, and pushed him out of the presidency.