Guatemala’s highest court has blocked President Jimmy Morales’s decision to unilaterally end a UN anti-corruption commission, which has angered the president by investigating him, his sons and his brother over allegations of graft.

Guatemala’s constitutional court overruled Morales’s decision after all-night deliberations on five appeals against the president’s cancellation of the agreement with the UN.

Morales has argued the commission, known by its Spanish initials as Cicig, had violated Guatemala’s sovereignty and violated the rights of suspects.

Given the government’s refusal to guarantee the commission’s security, the UN has withdrawn the commission’s members.

The court has tussled with Morales before over the commission, though he has sometimes tried to ignore its rulings. The court has said the commission’s mandate is valid through 2019.

Guatemala’s human rights prosecutor, Jordan Rodas, said Morales’s administration has to obey the new ruling.

“The government is under obligation to comply,” said Rodas, who presented one of the appeals to the court. “If it doesn’t obey, that is a whole other matter, and would constitute a coup, because the cornerstone of the rule of law is respect for the judicial branch.”

During its 11 years operating in Guatemala, Cicig has pressed corruption cases that have implicated about 680 people, including top elected officials, businesspeople and bureaucrats. The commission said in November that it has won 310 convictions and broken up 60 criminal networks.

The commission participated in investigations that forced former vice-president Roxana Baldetti and former president Otto Pérez Molina to step down from office in 2015 to face fraud and corruption charges.