On Monday, the Guatemalan government announced its withdrawal from a treaty with the United Nations which created an International Commission against Impunity in Guatemala (CICIG).

Although CICIG's mandate in the country is set to expire in nine months, Guatemalan President Jimmy Morales gave its international staff 24 hours to leave the country. UN Secretary-General Antonio Guterres condemned the decision, saying he expected "the government of Guatemala to entirely fulfil its legal obligations under the agreement".

The expulsion of CICIG is being decidedly decried as illegal, both nationally and internationally. In a place where the rule of law is an aspiration and the rule of incompetence a reality, CICIG emerged as a beacon of hope. After 10 years of work, the Inter-American Commission of Human Rights (IACHR) recognised the body's "crucial role" in the fight against corruption in Guatemala, through the disbanding of criminal networks and organised crime structures together with local prosecutors.

The IACHR also highlighted the support CICIG provides by training local officials and pushing for legal reforms to improve the efficiency of the justice system. Furthermore, it is estimated that its work has contributed to a net reduction of 4,500 homicides between 2007 and 2017. So why would a government seek to shut down such a mechanism if it has clearly helped improve the capacity of the Guatemalan state to deal with crime?

Before being elected, President Morales, who was a comedian before entering politics, presented himself as a staunch supporter of CICIG. However, his supportive attitude drastically changed when criminal investigations started closing on him, his family and his political party's inner circle.

In 2017, two days after being criminally indicted for illegal campaign financing, Morales announced his decision to declare Ivan Velasquez, the CICIG's chief, persona non grata. Tensions escalated when this decision was overruled by the Constitutional Court.

Subsequently, the government took several steps to dismantle and cripple CICIG's operational capabilities. For example, the government removed police support for the commission, and more recently revoked visas for international investigators. However, the Constitutional Court has repeatedly overturned the president's actions.

As these smaller attacks did not suffice to stop CICIG's work, Morales announced his decision not to renew its mandate in August 2018. He did so at a press conference surrounded by military officials, which was a chilling statement in itself for a country that has suffered vastly from a string of military coups in the second half of the 20th century.

While in theory, he was in his legal right to execute this decision, it was decried by members of the international community and local civil society. Local observers also saw it as a form of intimidation against members of the Constitutional Court as President Morales asserted he would not comply with "illegal orders".

The rising tensions between the president and the CICIG reached a culmination on Monday, when the government announced its intention to expel the anti-corruption panel. Within 24 hours, members of the prosecutor's office had to arrest migration officials who were in breach of the Constitutional Court ruling that allowed a CICIG investigator to enter the country.

The real reasons behind the government's haste to expel CICIG might be related to the upcoming general elections in June as well as the appointment of new judges to the Supreme Court and appellate courts.

Last time when these processes happened, it was under CICIG's watch and, as a result, candidates were under heavy scrutiny. The anti-corruption panel uncovered intricate collusion schemes to appoint judges and ensure kickbacks.

At the same time, the largest scandals CICIG has uncovered relate to illegal campaign financing that has spattered prominent business leaders. This might explain why some members of the private sector were quick to support Morales's challenge to the rule of law.

On Tuesday night, the Constitutional Court suspended the president's decision. A standoff between the court and the executive branch now seems inevitable. Its outcome could be disastrous for the young democracy as it could undo the current constitutional regime.

If the Guatemalan government is unwilling to comply with international law, it cannot be considered a trustworthy member of the international community, trade partner or destination for foreign direct investment.

There are also broader issues at stake for the UN. A corrupt, weakened government from a small Central American nation must not be allowed to disregard international agreements and "defeat" the UN. This would set a dangerous precedent and it must be avoided so as to preserve the legitimacy of the international legal system.

Central America is at the gates of a widespread democratic backsliding. Both Honduras and Nicaragua are ominous examples of the dire consequences of a collapse of the rule of law. In Guatemala, if Morales and his allies succeed in maintaining the corrupt status quo, the world can be absolutely certain that Guatemalans will continue to flee from their country.

The support of the international community to independent and brave judges, prosecutors, human rights defenders and transparency activists is needed now more than ever, as they are the ones who have kept Guatemala from slipping into the abyss.

The views expressed in this article are the author's own and do not necessarily reflect Al Jazeera's editorial stance.