ON DECEMBER 18th South Africa’s ruling party picked a leader. The new head of the African National Congress (ANC) is Cyril Ramaphosa, one of the handful of heroes who negotiated the peaceful dismantling of apartheid in the 1990s. In 2019 he will probably be elected president of South Africa. It is absurd—and a sign of how poisonous ANC politics have become—that his rivals within his own party dismiss him as a tool of “white monopoly capital”. That he won the party’s top job anyway shows that there is still hope for South Africa.

The choice should have been simple. Nkosazana Dlamini-Zuma, the candidate backed by Jacob Zuma, the country’s current president, promised more of the same. Under Mr Zuma’s administration, corruption thrives, state resources have been looted and democratic institutions have been undermined. By one estimate, as much as 150bn-200bn rand ($11bn-15bn), or 5% of GDP, has been misappropriated. Ms Dlamini-Zuma (who is Mr Zuma’s ex-wife) has remained almost entirely silent about what South Africans call “state capture”. In a 4,200-word speech kicking off her campaign, she did not mention corruption once. Many took this to mean that, if elected, she would shield Mr Zuma from prosecution on the 783 counts of corruption that he faces. She also vowed to curtail the independence of the central bank, put more people on the public payroll, fight the dreaded white monopoly capital and achieve “radical economic transformation” by ramping up state spending and expropriating land, mines and businesses.

Mr Ramaphosa, by contrast, promised “moral renewal”. He has been deputy president since 2014, but is untarred by the murk around Mr Zuma. In almost every campaign speech, he pledged to fight corruption. Unions backed him (he is a former union boss). Businessfolk backed him, too (he is a tycoon with a reputation for pragmatism). Polls said he was far more popular with ordinary voters. Yet his victory was terrifyingly narrow: fewer than 200 votes among almost 5,000 party delegates. Had the courts not disqualified more than 400 illegitimate delegates, many of them from provinces supporting the Zumas, Mr Ramaphosa would surely have lost.

Now for the hard part

Having averted the entrenchment of a dismal dynasty, he must set about undoing the damage Mr Zuma has wrought. The first step should be to remove him from office. Mr Zuma would ordinarily expect to serve another year and a half as president. That would be a disaster, as it would give the vultures around him yet more time to pick the bones of the state. Mr Ramaphosa should immediately press the ANC to recall Mr Zuma. If Mr Zuma fails to heed his party’s wishes, Mr Ramaphosa should urge a no-confidence motion in parliament. As deputy president, he would be next in line. He should appoint a credible head of public prosecutions who can decide whether to press those 783 charges of corruption against Mr Zuma. He should also set up a judicial commission of inquiry to probe allegations of state capture.

Mr Zuma will fight back. He has powerful allies among the ANC’s new senior leadership, and among those who benefit from cronyism. Graft in South Africa now runs wide and deep—even head teachers are murdered so that their successors can gain access to the tiny school budgets they control. Cleaning all this up will not be easy. But it is not impossible, if Mr Ramaphosa demonstrates that those in charge do not have impunity. His election could mean a new start for South Africa. The rand surged on news of his victory. Other investors will wait and see whether he is serious about reform. Ordinary South Africans will pray that he is.