JOHANNESBURG — As scandal after scandal unfolded, South African President Jacob Zuma maintained an affable demeanor in public, rallying his support base, dispatching lawyers to fend off court challenges and, it is alleged, enabling his corrupt associates.

Finally, the astute political operator whose on-stage dancing and singing delighted loyalists ran out of options, his reputation shattered by revelations of systemic graft in government. Abandoned by once-steadfast allies in the ruling party, Zuma was forced to resign Wednesday, ending a presidential tenure of nearly a decade, much of it marred by questions about his conduct and character.

Zuma has denied any wrongdoing. But the steady flow, and then flood, of allegations of impropriety on his watch reinforced a sense that South Africa had failed to live up to the hopes of its young democracy when apartheid ended in 1994.

Certainly, South Africa’s economic inequity and other sweeping problems could not be pinned on any one person, and Zuma could point to significant improvements since the end of white minority rule, including during his presidency. But the culture of corruption and impunity that flourished in his orbit could take years to overcome.

As public opinion turned against Zuma, some members of the ruling African National Congress party began to see him as a risk to its hold on power ahead of 2019 elections. His appearances in parliament turned chaotic as protesting opposition members were removed from the chamber.

The growing discontent over Zuma was evident in 2013 when mourners booed him during a Johannesburg stadium memorial for Nelson Mandela, South Africa’s first black president and global statesman.

Before that, Zuma had presided over one of democratic South Africa’s proudest periods — the staging of the World Cup soccer tournament in 2010. He was also leader during one of the most horrifying events — the fatal shooting by police of several dozen protesters during labor unrest at a platinum mine in Marikana in 2012.

Despite his fumbles and periodic scandals, Zuma was remarkably resilient and showed a deft touch during his career. In 2007, he beat then-President Thabo Mbeki in a race to lead the ANC party, opening the way for him to become president in 2009.

Zuma, 75, was born in what is now Kwa-Zulu Natal province, which later became a bed rock of support for the ruling party. South Africa was in the grip of apartheid during his youth, and he joined the armed wing of the ANC in 1962 after the anti-apartheid movement was banned.