Guatemala President Jimmy Morales announced that he was ending the commission's run in the country, but Guatemala's top court blocked the expulsion.
Thousands of Guatemalans marched on Saturday against President Jimmy Morales's bid to close a UN anti-corruption mission that sought to investigate him on suspicion of campaign finance violations.
Marchers chanted and waved banners reading "We reject the government of the corrupt" and "We are against impunity" amid rising international concern.
Morales notified the United Nations on Monday that the International Commission Against Impunity in Guatemala (CICIG) would close early.
It has been working since 2007 and has worked with the prosecutor's office on graft and organised crime cases, among others.
Morales has charged that the mission overstepped its duties.
But on Wednesday, the country's highest court stopped the ruling.
The Constitutional Court ordered government authorities to tell staff and civil servants to cooperate with the UN mission.
It is the latest twist in a saga that erupted last year when the CICIG made a joint request with the state prosecutor's office to lift Morales's presidential immunity as part of a probe into illegal campaign financing by his FCN-Nacion party.
Morales responded by saying he would not renew the CICIG's mission when it officially ends in September, and later tried unsuccessfully to block the mission's head, Ivan Velasquez, from entering the country.
UN Secretary-General Antonio Guterres insisted Guatemala was legally obligated to maintain the mission, which began in 2006.
CICIG and state prosecutors have presented evidence that Morales's FCN-Nacion party failed to report nearly $1 million in financing to electoral authorities.
It's not just Morales who is in the CICIG's sights, though. His son and brother were charged with tax evasion and money laundering in 2016.