The South African appeal court Tuesday accused the government of "disgraceful conduct" in allowing Sudanese President Omar al-Bashir to leave the country despite an arrest warrant from the International Criminal Court (ICC).
Bashir was not arrested while attending an African Union summit in Johannesburg last year as the South African government claimed he had immunity as the head of a member state.
When an emergency order was obtained from the High Court during the summit ordering Bashir's arrest, government lawyers admitted he had flown out of the country just a few hours earlier.
The government subsequently filed a plea against the arrest order at the Supreme Court of Appeal (SCA).
"The assurances that he was still in the country given to the (High) Court at the commencement and during the course of argument were false," the SCA judges said.
"It was disgraceful conduct."
SCA ruled that the failure to arrest Bashir was unlawful and dismissed the government's appeal.
South Africa is a signatory of the Hague-based ICC, which wants Bashir arrested for alleged war crimes related to the conflict in the Darfur region of Sudan.
The South African Litigation Centre (SALC) hailed the court ruling, saying it meant Bashir must be arrested if he returned to South Africa.
"The government should seek to uphold the rule of law instead of shielding suspected war criminals and the Supreme Court of Appeal has made this clear today," SALC director Kaajal Ramjathan-Keogh said.
The decision by South Africa not to arrest Bashir sparked international condemnation, which was met with a threat from Pretoria to withdraw its membership with the ICC.
The Sudanese leader has evaded justice since his indictment in 2009 for alleged crimes in the Darfur conflict in which 300,000 people were killed and two million forced to flee their homes.
The South African government made no immediate announcement on whether it would appeal against Tuesday's ruling.