South Africa's supreme court of appeal on Friday upheld a high court ruling to reinstate hundreds of corruption charges filed against Jacob Zuma before he became president.
State prosecutors set aside the charges in April 2009, paving the way for Mr Zuma - who has faced and denied numerous corruption allegations made since then - to run for president later that year.
Mr Zuma and the National Prosecuting Authority (NPA) were appealing against the high court ruling, made in April last year.
In his decision to reject their appeal, Judge Lorimer Leach said it was "irrational" for the NPA to have set the charges aside.
The NPA has responsibility for deciding whether to reinstate the charges, which relate to a 30 billion rand (Dh7.34bn) government arms deal arranged in the late 1990s. It was unclear when such a decision might be taken.
It was also not immediately clear if Mr Zuma would approach the constitutional court to try to set aside the supreme court's ruling, which was unanimous.
The NPA would need to consider the judgment, spokesman Luvuyo Mfaku said, adding it would "at all times do the right thing within the confines of the rule of law and in the interest of proper administration of justice".
"It is difficult to understand why the present regime at the NPA considered that the decision to terminate the prosecution could be defended," Judge Leach said.
The focus of the corruption allegations that Mr Zuma has faced since taking office has been on leaked emails pointing to the Gupta family, business friends of the president, using their influence to secure lucrative state contracts for their companies.
Mr Zuma and the Guptas have consistently denied wrongdoing.