GUATEMALA CITY — Guatemala’s highest court ruled Tuesday that President Jimmy Morales cannot expel the head of a U.N. anti-corruption commission from the country.

The president had issued his expulsion order for Ivan Velasquez early Sunday, two days after Velasquez and Guatemala’s chief prosecutor announced they were seeking to lift Morales’ immunity from prosecution in order to investigate alleged illegal campaign financing.

But the Constitutional Court, the country’s highest tribunal, quickly suspended the order Sunday, and on Tuesday the justices negated Morales’ order declaring Velasquez persona non grata. The court ruled the order was issued improperly.

The U.N. panel and local prosecutors have built popularity among many Guatemalans over the last decade by attacking the corruption long endemic in Guatemala, including helping force the previous president from office two years ago.

Morales’ order was met with anger from many Guatemalans, and it drew a barrage of criticism from the international community, including the United States. Earlier Tuesday, U.N. Secretary-General Antonio Guterres said he was shocked by the president’s action and expressed full support for Velasquez.

Although he initially defended the expulsion order, Morales softened his stand Monday and said he was willing to abide by court decisions on his action.

“People of Guatemala, as president of the republic I have and will respect the decisions of the other branches of government. The rule of law should always prevail,” he wrote in his Facebook account.

On Tuesday, Morales made his first public appearance since the crisis exploded, meeting with loyal mayors who voiced their support for him. The…