MEXICO CITY — Almost a dozen years ago, a panel of international prosecutors backed by the United Nations arrived in Guatemala. Their goal: to team up with the Guatemalan attorney general’s office, strengthen the rule of law and combat the criminal networks that had taken hold after the country emerged from more than three decades of civil war.

It was a bold experiment in outsourcing justice, but given Guatemala’s fragile democracy, its weak institutions and the extent of corruption in the country, the government was prepared to cede sovereignty.

Since the International Commission Against Impunity in Guatemala began its work in 2007, it has peeled back layers of corruption, helped strengthen the courts and professionalized the attorney general’s office, winning the approval of the Guatemalan people and sending powerful politicians, leaders of organized crime and businessmen to jail.

But when a 2017 inquiry into illegal campaign financing focused on President Jimmy Morales directly, he began to stifle the work of the commission, known as Cicig, according its Spanish initials.