A South Africa court declared that the decision taken by the government to withdraw the country from the International Criminal Court (ICC) as unconstitutional and invalid, as it has not been debated or voted by parliament.

The government of the African country on Wednesday notified the UN of its intention to leave ICC in October; a move that the High Court in Pretoria described as premature and irrational, Efe news reported.

The court concluded that the government does not have the power to take this action without parliament’s endorsement.

The ruling was issued on Wednesday following an appeal by the opposition Democratic Alliance party, however the government can still file a counter appeal.

South Africa had justified its decision to withdraw from the Rome Statute (the founding treaty of ICC) on the grounds that it was in conflict with its national law on diplomatic immunity and adversely affects its international relations.

The now annulled decision of South African President Jacob Zuma is at the forefront of measures taken by other African countries to leave ICC, including Kenya, Burundi and Gambia.

The leaders of these countries accuse ICC of pursuing African leaders exclusively and serving neocolonialist interests.

The Pretoria government openly challenged ICC in 2015, when it refused to arrest Sudanese President Omar al-Bashir, who travelled to Johannesburg to attend an African Union summit.