Guatemala faced a fresh political crisis Sunday as President Jimmy Morales tried to expel a UN official investigating him for suspected corruption, but was overruled by the courts.
The row comes two years since another graft affair that toppled a former president in the Central American country of 15 million people.
And it sparked international criticism, from the United States and several European countries.
Morales on Sunday turned against UN anti-corruption official Ivan Velasquez as his investigations threatened to engulf Morales in scandal too.
Morales said he ordered Velasquez, a Colombian national, to be expelled from the country "in the interests of the Guatemalan people, for the strengthening of the rule of law and our institutions," in a video published online.
Later in the day, the Constitutional Court temporarily suspended Morales's order, its chairman Francisco Mata told reporters.
That put Morales on the spot as protests broke out against the president and in favor of Velasquez.
Health Minister Lucrecia Hernandez resigned in protest over Morales's move, accusing him of supporting "impunity."
Her three vice-ministers plus competition commissioner Enrique Godoy followed her example in resigning.
An army spokesman said the force remained loyal to Morales.
Velasquez is the head of the UN International Committee Against Impunity in Guatemala (CICIG).
Morales cited articles of the constitution and international conventions, implying that Velasquez had interfered in Guatemala's internal affairs.
UN Secretary General Antonio Guterres was "shocked" by Morales's move and "has repeatedly reiterated his full confidence in Commissioner Velasquez," Guterres's spokesman Stephane Dujarric said in a statement.
"Mr. Velasquez has worked tirelessly to promote a culture that upholds the rule of law and rejects corruption."
US State Department spokeswoman Heather Nauert said Washington was "deeply concerned" and said the CICIG had to be "permitted to work free from interference by the Guatemalan government.
The US also joined Britain, Canada, France, Germany, Italy, Spain, Sweden and Switzerland in condemning the move, in a joint statement issued by their embassies in Guatemala City.
The commission helped prosecutors investigate the corruption scandal that toppled president Otto Perez in 2015.
Morales, a former television comedian, won the subsequent elections and took over as president the following year.
Now investigators say Morales is suspected of failing to declare electoral campaign funds. They estimate the value of the suspect transactions at about $1.0 million.
On Friday, Velasquez and Guatemalan prosecutors applied to strip Morales of his immunity so he can be probed over the payments linked to his party, the National Convergence Front.
That same day, Morales met with Guterres.
Morales also said he was firing his foreign minister Carlos Raul Morales.
The minister was involved in Friday's meeting with the UN chief and denied having demanded Velasquez's removal.
Reports of plans to expel Velasquez had already sparked angry protests outside the presidential palace on Saturday.
That raised the prospect of a fresh wave of unrest like the one that broke out against Perez in 2015.
Protests against Velasquez's removal erupted again Sunday at his commission's headquarters and the country's constitutional court, with demonstrators banging drums and blowing whistles.
"Velasquez is a man who came to make all those rotten corrupt people tremble," said Javier Coyoy, 42, a shopkeeper in the capital.
Right-leaning Protestant Morales, 48, had promised to fight corruption.
But his perceived lack of action since taking office last year has driven down his popularity.
Activist Jorge Santos, head of the UDEFEGUA human rights group, warned the expulsion of Velasquez could spark a new crisis.
"We are faced with a government that has lost its legitimacy almost immediately," he told AFP.
"Now we are starting to see a new day" of protests like those of 2015, he said.