A South African court has ruled the government's plan to withdraw from the International Criminal Court (ICC) was "unconstitutional and invalid", providing a boost to the embattled Hague-based institution.
The court has recently been fighting off allegations of pursuing a neo-colonial agenda in Africa, where most of its investigations have been based.
Three African states - South Africa, The Gambia and Burundi - last year signalled their intention to quit the ICC. The Gambia's President Adama Barrow, elected in December, said earlier this month it will remain in the ICC.
South Africa announced in October that it had lodged its decision to pull out with the United Nations, after a dispute over Sudanese President Omar al-Bashir visiting the country in 2015.
South African authorities refused to arrest Bashir although he faces an ICC arrest warrant over alleged war crimes, saying he had immunity as a head of state.
'Unconstitutional and invalid'
"The cabinet decision to deliver the notice of withdrawal ... without prior parliamentary approval is unconstitutional and invalid," said judge Phineas Mojapelo in the North Gauteng High Court.
The president and ministers "are ordered forthwith to revoke the notice of withdrawal," he added.
The court ruling was a setback for President Jacob Zuma's government, but Justice Minister Michael Masutha said the government still plans to withdraw from the court.
Masutha described the government's notification to the UN of its intent to withdraw from the Rome Statute, the 1998 treaty establishing the Hague-based court, as a policy decision.
He said the government would decide how to proceed, including a possible appeal, after reading the full judgment.
The opposition Democratic Alliance (DA) party, which was one of the groups that brought the court case, on the other hand, welcomed the judgment.
"The withdrawal by the South African government from the ICC was irrational and unconstitutional," DA MP James Selfie told AFP news agency.
"We would like South Africa to stay in the ICC because we believe that it is consistent with our constitution and with the legacy of Nelson Mandela.
"The government should go back to the drawing board and reconsider the thing afresh in light of this judgment."
The ICC, which launched in July 2002 and has 124 member states, is the first legal body with permanent international jurisdiction to prosecute genocide, crimes against humanity and war crimes.
Source: News agencies