South Africa's withdrawal from the International Criminal Court has been revoked, the United Nations secretary-general says.

A notice, dated Tuesday, on the UN treaty website said the move came after a South African court ruled last month that the country's decision to withdraw without parliament's approval was unconstitutional.

South Africa shocked the international community last year when it informed the UN chief it would withdraw from the court that pursues cases of genocide, war crimes and crimes against humanity. Withdrawal comes a year after notification.

South Africa's main opposition party challenged the withdrawal in court, saying it was illegal because parliament was not consulted.

READ MORE: Court rules ICC withdrawal plan unconstitutional

"South Africa does not want to be lumped together with pariah states who have no respect for human rights," the Democratic Alliance said after the court decision.

Three African countries last year made moves to leave the ICC, speaking fears of an African exodus. Only Burundi remains on a path to withdrawal.

The Gambia under new President Adama Barrow also has revoked its withdrawal.

Some African countries have argued that the court has unfairly targeted their continent and have instead advocated strengthening their own institutions to deal with threats to human rights.

All but one of the court's full-scale investigations are in Africa, though the majority were referred to the court by the African countries themselves and two by the UN Security Council.

South Africa's withdrawal announcement had followed a 2015 dispute over a visit by Sudanese President Omar al-Bashir, who is wanted by the ICC for alleged war crimes, crimes against humanity and genocide in Darfur.

READ MORE: African leaders and the bias of international justice

Bashir was allowed to leave South Africa even though a local court ordered authorities to arrest him.

Under the Rome Statute, signatory countries have a legal obligation to arrest anyone sought by the ICC.

South Africa has said the treaty contradicts its diplomatic immunity law and prevents the country from acting as a regional peacemaker, a role that could require it to host adversaries on its own soil.

The court based in The Hague, Netherlands, has more than 120 member states.

Backers of the court had been dismayed by South Africa's move to withdraw, especially after former President Nelson Mandela had been a strong advocate for the court's creation.