A decision by a Guatemalan court on Wednesday brought their goal closer: Thelma Aldana, a former attorney general and the only well-known presidential candidate to support Cicig, was barred from running.

Eliminating Ms. Aldana, who won international praise for confronting corruption, from the race makes it almost a certainty that Cicig will leave when its mandate finishes in September, said Alexander Aizenstatd, a constitutional lawyer.

The anti-corruption drive has won such support among Guatemalans that whoever is elected will not be able to scrap Cicig outright, Mr. Aizenstatd said. But he warned that a substitute could prove to be toothless, just “steps to appease popular sentiment.”

Much is riding on Cicig’s survival, and not just within Guatemala.

Since its creation a dozen years ago, Cicig has prosecuted more than 100 cases, bringing charges against some 700 people involved in more than 60 criminal networks and earning the trust of Guatemalans, who have taken to the streets in its defense. During a presidential campaign in which polls suggest that voters harbor deep distrust of their government and politicians, Cicig consistently wins the approval of well over half the population.

If Guatemala’s recent effort against corruption is rolled back, the ripples will likely spread all the way to the United States, where policy in the region has focused on stemming the flow of drugs and halting the exodus of migrants fleeing poverty and violence. Neither is possible without the sturdy rule of law, said William Brownfield, a senior fellow at the Center for Strategic and International Studies and the former United States assistant secretary of state for narcotics and law enforcement.

“Cicig’s work does play into the root causes of migration, of gangs, of drug-related issues,” said Mr. Brownfield.