JOHANNESBURG (Reuters) - A decision by South Africa to withdraw from the International Criminal Court (ICC) is unconstitutional, the country's High Court ruled on Wednesday.

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.

South Africa notified the United Nations of its intent to withdraw from the Rome Statute, the 1998 treaty establishing the Hague-based court, last October. The withdrawal would take this October.

High Court Judge Phineas Mojapelo on Wednesday ordered the government to withdraw the notice to quit the ICC, according to a ruling broadcast on television.

"We have won in our application to have SA's withdrawal from the #ICC set aside," the opposition Democratic Alliance party, which challenged the withdrawal, said on its Twitter feed.

It was not immediately clear whether the government would appeal the court ruling.

The ICC has had to fight off allegations of pursuing a neo-colonial agenda in Africa, where most of its investigations have been based.

Three African states - South Africa, Gambia and Burundi - last year signalled their intention to quit the ICC. Gambia's President Adama Barrow, elected in December, said earlier this month it will remain in the ICC.

South Africa said it was quitting the ICC because membership conflicted with diplomatic immunity laws.

Pretoria had in 2015 announced its intention to leave after the ICC criticised it for disregarding an order to arrest Sudanese President Omar Hassan al-Bashir, accused of genocide and war crimes, when he visited South Africa. Bashir has denied the accusations.