If it’s possible to identify the moment when Brazil’s anti-corruption purge derailed, it was probably an episode that Brazilians call “o PowerPoint.” In September 2016, federal prosecutors held a press conference to lay out the indictment of former President Luiz Inácio Lula da Silva for corruption and money laundering. In the now-infamous presentation, one slide showed 14 illustrated circles containing phrases like “corrupted governance,” “decision-making power,” and “bribe-ocracy,” all with arrows pointing to a larger circle in the center, ominously labeled “LULA.” Social media exploded with ridicule: It looked like something made by an intern on deadline. But the implications could not be more serious.

After an appeals court upheld his conviction last week, Lula, a legendary labor leader who oversaw both great progress and great scandal as president from 2003 to 2011, now faces a sentence of 12 years in prison. Many point to the decision as the highest example of justice being served in a country where impunity for the powerful has always been the rule. But while an abundance of evidence shows that Lula received special favors from government contractors—and he still faces several other accusations of wrongdoing—legal experts with no special sympathy for him have argued that due process may have been abbreviated in order to convict him. The matter is all the more concerning given that Lula had planned another run for president this year, and is still by far the frontrunner.

The case also revealed potentially fatal contradictions in what had promised to be a transformative movement for Brazil. Presenting Lula’s indictment at that press conference in 2016, Deltan Dallagnol, lead prosecutor on the federal investigation known as Carwash, called Lula the comandante máximo (“highest commander”) and “greatest beneficiary” of a scheme to funnel billions of dollars from government contracts to political allies. Strangely, though, Lula had not been formally accused of participating in a criminal organization, much less leading one. His alleged crime was more modest: taking $800,000 in bribes in the form of a luxury apartment. It was an especially modest sum given the tens of millions stolen by ostensibly less important players in the scheme. How to explain this disconnect?

It’s important to understand what Carwash was up against. From its modest beginnings as a probe into money laundering at a gas station in Brasília in 2014, Carwash had expanded into a groundbreaking operation targeting some of the country’s richest and most powerful people. To keep officials from stymying investigations—as had happened many times in the past—prosecutors courted public opinion from the start. When it came to Lula, Dallagnol needed to convince the average Brazilian that he was justified in bringing charges against the most popular president in the country’s history. (This may explain the PowerPoint slide.)

But the strategy was flawed. By casting Lula as the mastermind of an age-old system of kickbacks, Dallagnol implied that removing him from public life would put an end to that system. This idea ran up against Dallagnol’s own declared belief that corruption in Brazil reached far beyond the former president and his once-upstanding Workers’ Party, infecting the entire ideological spectrum of a self-dealing political class. And so in a fight where public opinion was key to its success, Carwash undermined its own basic premise for existing.

For Lula and his supporters, the quest to convict him amounted to straight-up political persecution. “There was a pact between the judiciary and the media to remove us from power,” Lula declared at a rally last week. “They couldn’t stand to see the poor rise up.”

Lula’s theory is farfetched. For one thing, even he does not dispute that he enriched himself after his time in office (legally or not). Carwash has also gone after his business-friendly opponents. Former congressman Eduardo Cunha, who led the 2016 impeachment of Lula’s chosen successor, President Dilma Rousseff, is serving a 14-year prison sentence. President Michel Temer, a Cunha ally, was accused last year by the prosecutor-general of corruption and obstructing justice.

The problem for Lula and the Brazilian left is that the right has proven much stronger politically. According to the constitution, the Supreme Court can’t authorize an investigation of a sitting president without congressional approval; Temer’s allies voted to block this. Last July, Temer even managed to shut down Carwash’s federal police task force—ostensibly a bureaucratic decision, but one that deprived meddlesome investigators of resources.

There are, however, reasons to believe that Carwash—driven not by ideology, but by moralistic zeal—had it out for Lula. Sérgio Moro, Carwash’s lead judge, is another champion of the anti-corruption movement. In March 2016, then-President Rousseff appointed Lula to her cabinet. Moro reacted by releasing a secretly recorded conversation in which she implied that the purpose of the appointment was to shield Lula, her mentor and ally, from prosecution. For exposing a private conversation with a sitting president, Moro was reprimanded by a Supreme Court justice. But another justice blocked Lula’s appointment, and he was soon indicted. Rafael Mafei, a law professor at the University of São Paulo, was among those to suggest that Moro should be removed from the case. “Personally, I don’t have confidence in Moro’s impartiality to judge Lula,” he said. Still, it was Moro who handed down Lula’s conviction in July last year.

Legal experts also found problems in Moro’s ruling itself. Documents and testimony left little doubt that Lula received an expensively renovated beachfront apartment from a contractor that paid bribes to the Workers' Party. But the apartment had not even been built when Lula left office. Fábio Tofic Simantob, an attorney who leads a defendants’-rights organization, said Moro had failed to convincingly link the apartment to Lula’s role as president—a link that must exist in order for favor to be classified as bribe. “Is it questionable, reprehensible, morally condemnable for an ex-president to accept a gift from a contractor?” Tofic wrote. “If true, it seems censurable to us. But not a crime, at least not according to Brazilian law.”

The problems didn’t stop with Moro. Just one day after Lula’s conviction, an appeals court promised to review his case prior to the 2018 election (apparently because, according to Brazilian law, a candidate is barred from seeking office only when his conviction is upheld by a higher court). No one expected an acquittal: Months before the decision, the chief appeals judge told a reporter that while he had not read the case evidence, he found Moro’s ruling “technically irreproachable.” Lênio Streck, a law professor and former prosecutor, said this statement violated ethics rules that ban judges from commenting on open cases. No matter: The decision came on January 24, faster than in any other Carwash appeal.

In his ruling, Moro cited the 17th-century English writer Thomas Fuller: “Be you never so high, the law is above you.” Lula should not be spared from prosecution just because he’s popular. But if a public figure is to be removed from politics without a vote, the case should be bulletproof.

Adriano Pilatti, a law professor at the Pontifical Catholic University in Rio de Janeiro, pointed out that all this reckless expediency only fuels Lula’s claim that the case against him is politically motivated. It also lends a veneer of democratic credibility to political machinations against Carwash. In Congress, Lula’s Workers’ Party has surreally teamed up with Temer’s coalition to rein in the power of prosecutors.

Lula stands little chance of reversing his conviction, but until he is actually led to prison—and his lawyers will exhaust every procedural move to forestall that—he will continue campaigning for president. He may even run from a jail cell, as a self-styled martyr, with a problematic conviction as his rallying cry. It’s not impossible for him to win the election before higher courts decide on appeals against the barring of his candidacy. And so the stage is set for yet another institutional crisis. It’s little wonder that Brazilians are losing faith in democracy.

If Lula’s conviction turns out to be part of a real transformation of Brazilian politics, perhaps the fallout will be worthwhile. But it could just be the last hurrah of an anti-corruption movement that was as promising as it was fleeting. And for bending due process to an obsession, Carwash itself will deserve some of the blame.