Guatemala’s top court on Tuesday ruled definitively against President Jimmy Morales’ internationally criticised push to expel the head of a UN-backed anti-corruption unit probing his campaign financing.

The decision by the Constitutional Court ratifies a provisional ruling that the government could not expel Ivan Velasquez, a veteran Colombian prosecutor who leads Guatemala’s International Commission against Impunity, known as CICIG.

Morales on Sunday ordered the expulsion of the prosecutor, who has been a thorn in the president’s side by investigating his son and brother and seeking to revoke the president’s immunity from investigation over more than $800,000 in potentially unexplained campaign funds. Morales has denied any wrongdoing.

Within the United Nations, Velasquez has the rank of assistant secretary-general. He is widely respected and the president’s move unleashed a series of resignations from his cabinet and a storm of criticism from Western nations.

READ MORE: Guatemalan deportees get fresh start as volcano guides

Earlier in the day, Morales, 48, said he would respect the court’s decision, stepping back from the brinkmanship he displayed at the weekend when he said the court had overstepped its mandate by ruling on the case.

He has sought support from Guatemala’s mayors, possibly to try to counter the diplomatic pressure and street protests by activists calling him corrupt.

“I am not defending corrupt people, I am not against the anti-corruption fight, I am not even against the CICIG. Is a machete good or bad? It depends on who is wielding it,” said the former comedian at a meeting with mayors.

Morales won office in 2015, running on a platform of honest governance after his predecessor Otto Perez Molina was forced to resign and imprisoned in a multi-million dollar corruption case stemming from a CICIG investigation.

The United Nations on Tuesday said it was “disturbed” by Morales’ moves against Velasquez, while the Geneva-based International Commission of Jurists said failure to comply with the Constitutional Court ruling could constitute “obstruction of justice”, a criminal offence.

“The president’s decision to declare Ivan Velasquez as ‘non grata’ and ordering his immediate removal from the country is in clear breach of international law,” the ICJ said in a statement.

Hundreds of Guatemalans took to the streets on Monday in support of Velasquez, some shouting “Take Jimmy Morales to court!” Some groups came out in support of the president and against foreign interference.

The US ambassador to Guatemala, Todd Robinson, told Reuters the president’s moves could put at risk a US development plan in Central America to reduce poverty and crime.

OPINION: An end to impunity in Guatemala?

“There will probably be consequences from the president’s decision,” Robinson said while emphasising that any US measures would have to be carefully thought through so as not to affect the economy or migration to the United States.

Many politicians in Guatemala consider the foreign-led body, which is unusual among UN bodies for its powers to bring cases to prosecutors, to be a violation of national sovereignty.

Anti-corruption activists credit it with cleaning up government.

With the Constitutional Court’s ruling now out of the way, Guatemalans are watching the Supreme Court as it considers the prosecutors’ request to strip Morales’ immunity.