JOHANNESBURG (Reuters) - South Africa’s High Court ruled on Friday that President Jacob Zuma’s appointment of a state prosecutor to decide whether to reinstate corruption charges against him was not valid and should be set aside immediately.

President of South Africa, Jacob Zuma speaks during the Energy Indaba conference in Midrand, South Africa, December 7, 2017. REUTERS/Siphiwe Sibeko

The court also ruled that Zuma should not make a new appointment and that Deputy President Cyril Ramaphosa should appoint a new public prosecutor within 60 days.

The ruling is a stinging rebuke for Zuma, who is due to step down in 2019 after more than a decade in power. Zuma’s office said he would appeal the decision.

The National Prosecuting Authority (NPA), whose head prosecutor Shaun Abrahams was removed from his post by the High Court ruling, also said it would appeal.

The rand was buoyed by the court ruling, with analysts saying markets saw Zuma’s influence curtailed.

Judge President Dunstan Mlambo said at the Pretoria High Court the appointment of Abrahams as the National Director of Public Prosecutions was “invalid and set aside.”

In his ruling, Mlambo said: “In our view, President Zuma would be clearly conflicted in having to appoint a National Director of Public Prosecutions, given the background ... and particularly the ever present specter of the many criminal charges against him that have not gone away.”

The charges against Zuma relate to a 30 billion rand ($2 billion) government arms deal arranged in the late 1990s and have amplified calls for Zuma to step down before his term as president ends in 2019.

In October the Supreme Court of Appeal upheld an earlier decision by a lower court that the nearly 800 corruption charges filed against Zuma before he became president be reinstated.

It then fell to Abrahams, appointed by Zuma as chief state prosecutor in 2015, to decide whether or not the NPA would pursue a case against Zuma.

Abrahams gave Zuma until the end of November to make representations to prevent the charges being brought against him. Abrahams has not commented on whether Zuma presented any submissions of what decision he has taken on the matter.

The case in the Pretoria High Court had been brought by a trio of civil society organizations seeking an order declaring the previous state prosecutor’s removal was invalid.

Zuma has faced a string of corruption allegations during his time in office, many of them over leaked emails that suggest his friends the Gupta family may have used their influence to secure lucrative state contracts for their companies.

Zuma and the Guptas deny wrongdoing.

The African National Congress (ANC), which is set to elect Zuma’s successor next week, said it would allow the parties involved to reflect on the judgment and its implications as well as decide whether to appeal or not.