Guatemala's Constitutional Court has blocked President Jimmy Morales' order to expel the head of a UN anti-corruption commission that is investigating his campaign financing.

Fransisco de Mata, the president of the court, said on Sunday that it had issued a temporary injunction blocking the order to expel Ivan Velasquez, head of the UN International Committee Against Impunity in Guatemala (CICIG).

The court will now analyse the case before reaching a definitive decision. It was not clear how long that would take.

Morales had earlier said in a video posted on Twitter that the expulsion was "in the interests of the Guatemalan people, for the strengthening of the rule of law and our institutions".

READ MORE: Comedian elected Guatemala president

He also announced the firing of Foreign Minister Carlos Raul Morales for failure to carry out the expulsion.

Morales' order came after Velasquez and Guatemala's Chief Prosecutor Thelma Aldana announced on Friday that they would seek the removal of the president's immunity so he could be investigated for campaign finance violations in 2015.

Velasquez, a Colombian national, said in the joint news conference with Aldana that funding of some campaign expenditures could not be explained. Morales has repeatedly denied any wrongdoing.

Velasquez heads a 10-year-old commission of experts that has worked with Guatemalan prosecutors to root out corruption in the country.

The commission was key to bringing down former President Otto Perez Molina, who was forced to resign in 2015 and remains in prison.

Morales, a former comedian, won the subsequent elections and took over as president the following year.

'State of flux'

Morales' initial order of expulsion was not received well both at home and abroad.

UN Secretary-General Antonio Guterres was "shocked" by Morales' move and "has repeatedly reiterated his full confidence in Commissioner Velasquez", Guterres's spokesman, Stephane Dujarric, said in a statement.

The embassies of international donor countries that support the UN commission - the United States, Germany, Canada, Spain, France, the UK, Sweden, Switzerland, as well as the European Union - issued a joint statement regretting Morales' decision.

The commission "has played a vital role in the fight against impunity and corruption that undermine security and prosperity in Guatemala. The decision to expel Commissioner Ivan Velasquez harms the ability of CICIG to achieve its mandate," the statement said.

Reports of plans to expel Velasquez had already sparked angry protests outside the presidential palace on Saturday.

Some 2,500 people demonstrated in the capital, Guatemala City, to demand Morales to resign.

Protests against Velasquez's removal broke out again on Sunday at his commission's headquarters and the country's Constitutional Court after the order.

"Things really are in a state of flux," said Al Jazeera's David Mercer, reporting from the Guatemalan city of Antigua.

"People are taking to the streets both to show their support for Velasquez and also show their disappointment in Morales," he added.

Sunday's move capped days of speculation that Morales would move against Velasquez.

The president had travelled to the UN last week to meet Guterres and the government said topics included circumscribing the mandate of the anti-corruption commission led by Velasquez.