Guatemala's constitutional court has suspended a decision by the government to kick out a UN body that was investigating the country's president.
The International Commission Against Impunity in Guatemala (CICIG) has been running for more than a decade.
On Monday, politicians informed the body it had 24 hours to leave.
The commission was investigating President Jimmy Morales over alleged funding irregularities during his 2015 election campaign.
He has accused it of acting illegally and undermining Guatemalan sovereignty.
Last year, the president said he would not extend the body's mandate, which is due to expire in September 2019.
But on Monday, his foreign minister Sandra Jovel announced that the decision had been brought forward.
During a meeting with UN Secretary General Antonio Guterres in New York, Ms Jovel handed over a letter confirming the government's intention to terminate an agreement which established the commission.
Mr Guterres said he strongly rejected the letter's contents, and called for Guatemala to fulfil its obligations.
On Tuesday, members of the UN commission began leaving "until further notice", citing security.
A vigil was held outside the organisation's headquarters in Guatemala City, protesting against the president's decision.
But in the early hours of Wednesday, the country's top court suspended the government's decision. The judges reached the decision after eight hours of deliberation overnight.
In its 11 years of operation, the CICIG has helped prosecutors bring cases against hundreds of people in Guatemala - including high-profile business and political figures.
It was established in 2006 to help the country achieve prosecutions in difficult areas, including organised crime.