Guatemala's top court on Tuesday scrapped a widely criticized order by President Jimmy Morales expelling a UN anti-corruption official who is investigating graft allegations against him.
The Constitutional Court's permanent suspension of the order follows a temporary stay it had already placed against the order hours after it was issued on Sunday.
Morales has accused Ivan Velasquez, a former Colombian judge who heads the UN International Committee Against Impunity in Guatemala (CICIG), of interfering in domestic affairs and provoking a political crisis with his probe.
Just before the court's verdict against his designation of Velasquez as persona non grata, Morales, while citing passages from the Bible, insisted during a meeting of mayors that the expulsion would go ahead.
His move against the UN official had sparked an outcry in Guatemala and widespread international condemnation.
Protesters in the country have called on Morales to quit, his health minister resigned in protest and the United States, Canada and major European nations slammed the order.
UN Secretary-General Antonio Guterres was "shocked" by Morales's move, his spokesman Stephane Dujarric said in a statement.
On Tuesday, the Washington Office on Latin America, a human rights advocacy group, said Morales's step went against the Guatemalan constitution.
The CICIG helped Guatemalan prosecutors investigate a corruption scandal that toppled the previous president, Otto Perez, in 2015.
Morales -- who was previously best known in the country as a bumpkin character on TV played for laughs -- was elected as his successor on pledges to clean up Guatemala's pervasive corruption.
But the CICIG says the president is suspected of failing to declare electoral campaign funds. They estimate the value of the suspect transactions at about one million dollars.
On Friday, Velasquez and Guatemalan prosecutors had applied to strip Morales of his immunity so he can be probed over the payments linked to his party, the National Convergence Front.
Announcing the Constitutional Court's scrapping of Morales's order, chief judge Fransisco de Mata told a news conference that an "exhaustive analysis" led the bench to decide a "definitive suspension."
He said the ruling would be communicated to the foreign and defense ministries, along with the police service, so that Velasquez's expulsion could not be carried out.