South Africa's decision to withdraw from the International Criminal Court (ICC) has been ruled "unconstitutional and invalid" by the High Court.
South Africa notified the UN of its intention to leave last October, accusing the ICC of undermining its sovereignty.
But the opposition Democratic Alliance (DA) argued that the government had to first seek parliamentary approval.
The court ordered the government to revoke its notice of withdrawal.
The decision to pull out came after a dispute over Sudanese President Omar al-Bashar's visit to the country in 2015.
South African authorities refused to arrest Mr Bashir despite him facing an ICC arrest warrant over alleged war crimes.
Mr Bashir was attending an African Union summit in Johannesburg, when the government ignored an ICC request to arrest him.
The DA welcomed the judgement.
"The withdrawal by the South African government from the ICC was irrational and unconstitutional," DA lawmaker James Selfie told AFP.
"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."
Latest Stories
-
Scores injured in Walewale as soldiers are accused of brutal assault
40 seconds -
Mahama meets Mamprugu king over Bawku chieftaincy stalemate
17 minutes -
Mahama calls for robust investment to uplift vulnerable populations
27 minutes -
Policy Expectations of the New Government: A robust asset and liability declaration framework
1 hour -
Engender trust to resolve Bawku crisis – Former Defence Minister Dominic Nitiwul advises
2 hours -
Guardiola divorces wife of 30 years
2 hours -
Up to 4 in 10 people could develop dementia after 55. What you can do to lower your risk
2 hours -
Mohbad’s widow, father face-off over DNA test
2 hours -
US to remove Cuba from state sponsors of terror list
2 hours -
Jideofor Adibe: Democracy and its Discontents in Africa
2 hours -
Sierra Leone declares emergency over mpox outbreak
2 hours -
South Korean investigators arrest impeached President Yoon, ending weeks-long standoff
2 hours -
Attack on Electrochem sends wrong signals to investors – Ada Traditional Council
3 hours -
Couple in court for allegedly defrauding urban planner of GH¢320K
3 hours -
US markets watchdog sues Musk over Twitter stake disclosure
3 hours