South Africa's Constitutional Court ruled on Friday that parliament had failed to hold President Jacob Zuma to account over a scandal related to state-funded upgrades to his home, and must launch proceedings that could remove him from office.
The ruling is the latest judicial setback for Zuma, of Africa's most industrialized economy before an election in 2019.
While the ruling comes nowhere near starting an impeachment process against Zuma now, it gives parliament six months to make provision for the removal of a president.
It was not immediately clear what specific steps parliament would take, and whether any concrete action would be completed before the election, but analysts said the decision would add to the mounting pressure on him to step down.
The rand currency was almost 1 percent firmer on the last day trading day of the year.
Zuma, 75, is already in a weakened position after Deputy President Cyril Ramaphosa was narrowly elected leader of Zuma's ruling African National Congress (ANC) last week - although Zuma's faction still retains key positions in the party and he has already survived no-confidence votes.
"We conclude that the assembly did not hold the president to account ... The assembly must put in place a mechanism that could be used for the removal of the president from office," Judge Chris Jafta said, handing down the judgement, which was supported by a majority of the court, and shown on live television.
"Properly interpreted, Section 89 implicitly imposes an obligation on the assembly to make rules specially tailored for the removal of the president from office. By omitting to include such rules, the assembly has failed to fulfil this obligation."
The court ruled that parliament, where the ANC holds a commanding majority, needed to act within 180 days.
"The court is saying that there is no mechanism in place to implement the provision regarding impeachment ... They must make a provision within the rules for that to happen," said Lawson Naidoo, the executive secretary of the Council for the Advancement of the South African Constitution, an NGO.
The ultra-left Economic Freedom Fighters (EFF) and other small opposition parties had taken the issue to the Constitutional Court. Dozens of EFF supporters, clad in their trademark red shirts and berets, danced and sang outside the court after the judgement was delivered.
Daniel Silke, director of Political Futures Consultancy, said the ball was now in the ANC's court.
"The pressure will come from within the ANC to engineer a dignified exit for President Zuma ... this judgement hastens or adds substantial pressure for an early retirement by Zuma," he told Reuters.
"It is not about him anymore, it about the party trying to chart a new course without the divisiveness that the Zuma issue brings," he said.
Zuma, an earthy politician with scant formal education who spent a decade in prison with Nelson Mandela for fighting apartheid, has faced numerous corruption allegations throughout his presidency. He has denied wrongdoing.
He has also been politically hobbled by a dismal economy that was hit by damaging ratings downgrades earlier this year after he sacked a respected finance minister.
"The ANC will study the judgement and discuss its full implications when the National Executive Committee meets on the 10th January 2018," the party said in a statement.
The judgement stemmed from a scandal that had faded from view in recent months as new allegations of corruption have swirled around Zuma.
In March 2016, the Constitutional Court ruled that Zuma pay back some of the roughly $15 million in state money spent upgrading his private home on a sprawling compound in rural KwaZulu-Natal province.
The upgrades included a cattle pen, chicken run and a swimming pool that the police ministry famously described as a "fire pool" required for fire-fighting purposes.
The unanimous and stinging ruling by the 11-judge court said Zuma had failed to "uphold, defend and respect" the constitution by ignoring the findings of former Public Protector Thuli Madonsela, whose office is an anti-graft watchdog with a strong constitutional mandate.
Zuma has since repaid 7.8 million rand ($631,000) - the sum determined by the Treasury as the "reasonable cost" he should bear - while also surviving a no-confidence motion in parliament where members of own his party voted to oust him.
But opposition parties argued that parliament has not done enough, given the gravity of the court's findings.
An impeachment motion was brought to a vote in parliament shortly after the judgement but the court ruled that this was not enough.
"The assembly simply debated and voted on the motion ... Therefore, we conclude that the assembly did not hold the president to account," Jafta said.