For Luiz Inácio Lula da Silva, the past few weeks have been nothing if not challenging. On March 4, the former president of Brazil was taken from his home by police and questioned as part of Lava Jato (“car wash”), an investigation into a massive corruption scandal involving Petrobras, the state oil company and the country’s largest firm. Officials from several political parties—among them the leftist Worker’s Party (PT), founded by Lula and his compatriots and in power since 2003—are accused of taking kickbacks siphoned from overpriced contracts Petrobras has been delivering to outside firms.

Sérgio Moro, the federal judge from the conservative state of Paraná leading the investigation, wanted to find out if Lula bore any responsibility for the scheme, in which Petrobras allegedly directed billions of dollars to the PT, the Brazilian Democratic Movement Party (PMDB), and Progressive Party (PP) and whether Lula benefited directly from the Petrobras money. The press, tipped off ahead of time, sent reporters and cameramen to watch the unfolding of what was essentially an arrest without charge—a kind of coerced questioning. Lula cried foul, and soon after his release from custody, his successor, President Dilma Rousseff, appointed him her chief of staff, a position with prosecutorial immunity. The move was widely seen as an attempt to protect Lula from Moro. In response to Lula’s nomination, the judge then leaked several telephone conversations that, according to Brazilian law, could not be publicized. Now, large numbers of Brazilians want him jailed, despite the inconclusive investigation. But Lula is a popular, transformative politician, and he has also garnered sympathy from millions, even as Rousseff’s government quakes amid protests, falling national economic fortunes, and the Petrobras probe.

The Petrobras scheme was likely initiated under Brazil’s former leadership, yet only the Worker’s Party has come under scrutiny.

What comes next for Lula is up to Brazil’s Supreme Court, which will decide whether he can take the job. It is something of an irony that Lula’s fate hangs in the judicial balance, given that he was instrumental in empowering a court system that had languished under the government of his predecessor, Fernando Henrique Cardoso. Now the investigative and prosecutorial machinery Lula enabled has come after him and his party.

But while there is corruption in the PT, the party is hardly unique in that respect; its opposition, until very recently spared by investigators, is no better. Evidence to date suggests that the Petrobras scheme was likely initiated under Cardoso, though his party has not come under scrutiny. Indeed, there is strong reason to believe that the judge and his supporters have political motives—that their goal is less to ensure good governance and the evenhanded delivery of justice than to criminalize the PT and destroy its reputation.

The Petrobras investigation is historic not only because it has now ensnared a former president but also because the scandal speaks to the shifting balance of power among Brazil’s core governing institutions, a movement that has been underway since the adoption of the new constitution in 1988.

That constitution is well known globally for generous social provision, including universal health care, unemployment benefits, cash transfers to poor and elderly people, and a guaranteed right to adequate nutrition. A second, less noted aspect of the 1988 constitution is the creation of a new equilibrium among the three branches of government. Brazil, like other Latin American countries, has historically had very strong executive power and a weak judicial branch. Elites have generally been able to take advantage by cultivating favor with rulers. Though the country has had many financial scandals, before 1988, no banker had ever been arrested. And, in spite of overwhelming corruption in bids for public-sector projects, large contractors were never investigated.

The drafters of the 1988 constitution therefore sought to bolster the judicial system. The Supreme Court was authorized to charge and judge politicians, finally subjecting the Congress and president to oversight, at least in theory. The constitution also established an independent public prosecutor’s office, the Ministério Público. The prosecutor is tasked with rooting out corruption and can force the government to halt bidding on public contracts when there is suspicion of price gouging or kickbacks. The prosecutor also brings action against the federal government at the Supreme Court. In addition, the new constitution assigned to the Federal Police the task of investigating corruption linked to federal government resources.

The effects of this reform have come in fits and starts. The Supreme Court showed its vigor in the impeachment of former president Fernando Collor in 1992, though most of process took place within Congress. But during Cardoso’s administration, accountability institutions weakened. He starved the Federal Police of funding and sought to manipulate the Ministério Público by handpicking its leader. Although the Ministério Público is independent, the president is allowed to select the chief prosecutor from a list drafted by the office. Cardoso selected number thirty-one on the list, Geraldo Brindeiro, a lawyer to whom he was very close. As chief prosecutor, Brindeiro proved unwilling to investigate most suspected wrongdoing. So eager was he to set cases aside that he became known as the “general shelver of the republic.”

The PT’s commitment to strengthening state effectiveness demanded a different approach. Lula repeatedly selected the top name on the list for chief prosecutor. Rousseff has followed suit. In 2002, the last year of Cardoso’s administration, the Federal Police carried out a total of fifteen operations. In 2009, there were 288 such operations. Lula and Rousseff also did not try to obstruct the Supreme Court’s 2012 Mensalão trial, which brought down several of Lula’s deputies. It was an affirmation of the new constitution: the first corruption conviction of politicians by the current Supreme Court.

It is this newly empowered judiciary that the PT is now up against. Lava Jato, underway since only March 2014, delves into a scandal originating in Brazil’s status quo politics, particularly its campaign financing mechanisms. Major government contractors are the largest contributors to Brazilian political campaigns and have been for some time. These relations between the federal government and so-called empreiteiras date back to the 1950s and were enhanced under the authoritarian regime. Empreiteiras overwhelmingly win bids for roads and other government infrastructure, including contracts with Petrobras. These have become more lucrative as the oil sector has grown since the mid-1990s.

The PT has unquestionably been a partner in this dance, as state agencies, under its watch, have funnelled contracts to companies that finance the party’s campaigns. The same was true of the previous governing party, the Brazilian Social Democracy Party (PSDB). Moro alleges that the empreiteiras vying for Petrobras’s contracts colluded to drive up the value of those contracts and then kicked back some of the vast ill-gotten gains to Petrobras executives, and members of the PT, PMDB, and PP.

Several of these executives have admitted to taking the kickbacks. In exchange for lenience, they accepted plea bargains in which they alleged that the PT benefited as well. The odd thing is that Cardoso appointed these executives, including former Petrobras Director Paulo Roberto Costa, who has admitted his involvement in the scandal, and long-time Petrobras hand Pedro Barusco, who confessed to receiving millions in kickbacks since 1998. Nestor Cerveró, whom Cardoso selected to run Petrobras’s international operations, lined his pockets through the 2002 acquisition of the Argentinian oil company Pérez Companc. During his administration, Cardoso’s son-in-law, David Zylbersztajn, was head of the National Agency of Petroleum, Natural Gas and Biofuels, responsible for regulating the oil sector during a period when the scheme was already underway. There is every reason to suspect that the PT appropriated a corruption scheme instituted under Cardoso’s PSDB government. Yet Moro has not investigated Cardoso, his associates, or his party even though the names of important PSDB figures, such as current leader and past presidential candidate Aécio Neves, have surfaced several times in plea-bargaining.

Lava Jato has won Sérgio Moro many fans in Brazil, and the global press can’t stop gushing. Fortune magazine ranked him thirteenth in its list of the world’s greatest leaders, the Washington Post called him “Brazil’s new hero,” and the Wall Street Journal compared him to a soccer star. Yet admirers in Brazil and abroad tend to downplay his violations of the rule of law and the politization of his investigation.

Moro is a student of anti-corruption prosecution and is influenced by Italy’s early-1990s Mani Pulite (“clean hands”) operation, about which he wrote in 2004. In his article, he claims the virtual extinction of the Italian Christian Democrats and Socialists as benefits of Mani Pulite. Given how he has overseen Lava Jato, it seems clear that he hopes his operation will mirror the effects of Mani Pulite, ridding the nation of a left-leaning political party, in this case the PT.

The first phase of Lava Jato aimed not at politicians but at Petrobras executives and the criminals who laundered their money. It was an amazingly successful deployment of Brazil’s new accountability institutions. All of the suspects accepted plea bargains, which came to the country only after demonstrations in June 2013. The executives all agreed to return the stolen money.

The next phase began on November 13, 2014, with the simultaneous arrests of all the important empreiteiros (owners of the contracting firms). At this point, however, the shine on the investigation begins to tarnish. Although Brazilian law typically prohibits jailtime without conviction, Moro held the empreiteiros in custody for as long as he felt necessary—most for more than 120 days. The empreiteiros appealed to upper courts for their release but were denied. Together, Moro and the upper courts ran roughshod over the presumption of innocence. He offered all of the arrested empreiteiros plea bargains in exchange for providing the names of politicians receiving kickbacks. Those who cooperated were released, and those who did not were kept in custody whether or not there was evidence against them. The press supported Moro despite evidence of rights violations.

With testimony from some of the arrested empreiteiros in hand, Moro moved on to the current phase of his operation: criminalizing the PT and coming after Lula. Moro and his team investigated every detail of Lula’s political life. They also investigated all contracts involving Lula at the Brazilian Development Bank, under suspicion because its loans benefited contractors involved in the scandal. No wrongdoing on Lula’s part was found.

Sérgio Moro, the investigating judge, has withheld documents implicating Lula’s political opponents in the Petrobras scandal.

Finally, Moro arrived at details of Lula’s personal finances, where he found what he considered a smoking gun: an empreiteira renovated a penthouse that Moro accuses Lula of owning. But there is no evidence of Lula’s ownership, though he was offered an option to buy the property. Even if Lula owned the apartment, the renovation would not be unusual by Brazilian standards. Ex-presidents frequently receive gifts from empreiteiras, much as American politicians, once out of office, often take advantage of massive fees in exchange for brief public appearances and speaking engagements.

The lynchpin of the third phase of Lava Jato may be the investigation of Odebrecht, the largest contractor in Brazil and the biggest engineering firm in Latin America. In 2014, Odebrecht gave less to Rousseff than to her competitor, the PSDB’s Neves. This might have led to the investigation of opposition finances. But, instead, Moro selectively criminalized Odebrecht money by investigating only the company’s contributions to Rousseff’s campaign. He has investigated Odebrecht money given to Lula’s institute but not to Cardoso’s institute. He has never investigated Odebrecht contributions to the Neves campaign or possible PSDB involvement in the kickback scheme, even though Odebrecht’s contributions to PSDB campaigns are well known, and links between the party, Petrobras, and the empreiteiras have never been in doubt.

In the weeks since Lula’s questioning, Moro’s zeal has been on full display, finally earning him public and judicial rebuke. The March 4 procedure—in which Federal Police, likely hoping to take Lula to Paraná, questioned him at São Paulo’s Congonhas airport—was itself illegal, relying on a mechanism called “coercive conduction,” which is only applicable if a suspect avoids questioning at least twice. Moro has used this same procedure throughout Lava Jato more than a hundred times, with news networks watching along the way. Usually he has succeeded—after all, the suspects have generally been business executives little loved by the population. The attempted coercion of Lula, though, provoked a huge cry at the street level and among legal scholars.

The March 16 leaks were Moro’s next step over the line. Among the released recordings were conversations between Lula and his attorneys, a violation of attorney-client privileges that Moro admits. Moro also leaked privileged conversations between Lula and other politicians, including Roussef. What is more, Moro himself ordered the Federal Police to stop recording Lula at 11 a.m. that day, however, the tapping continued. Moro then released all the tapes, including those recorded after the cutoff, to Globo, Brazil’s largest news network. Circumventing the courts in favor of the media and inflamed popular opinion, Moro attempted to justify the leaks by declaring that they were in the public interest.

At this point, the Supreme Court finally had enough of Moro’s extrajudicial activities. The Supreme Court has the power to discipline lower courts, and Judge Teori Zavascki came down hard. In light of the illegal wiretapping and leaking, he charged Moro with violating Article 5 of the Constitution, which governs due process. Zavascki also declared some of the taped conversations legally irrelevant and argued that public interest could not justify the illegal release of the taped conversations. The ruling is the gravest judicial setback for Moro since the launch of Lava Jato.

Judge Sérgio Moro, the chief investigator of the Petrobras scheme, was rebuked by the Supreme Court for due process violations. / Senado Federal

On March 23, a day after Zavascki announced his opinion, Moro responded with another leak. This document listed two hundred politicians who had received Odebrecht’s money, including non-PT politicians such as Neves. But the leak doesn’t represent a change of heart so much as strategy. Moro had the document for more than a month before releasing it, indicating that, even with evidence of wrongdoing across partisan lines, he hoped to focus his efforts on Lula and keep the media spotlight on the PT. But, under the Supreme Court’s criticism, he has been forced to change course. The latest leak is a clear challenge to Zavascki. Beyond this, it places a sword of Damocles over the rest of the political system, now on notice that Moro may come after them, too.

Where Brazil goes from here is an open question. The PT will probably relinquish power, leaving the presidency to the PMDB. The three large parties could save the political system by confessing collective wrongdoing in relation to campaign financing. The new cross-partisan list of implicated politicians positions Moro against any moves likely to maintain the existing parties, though his next steps will be constrained by the Supreme Court.

But Moro’s strength may yet grow, judicial setbacks notwithstanding. After illegally releasing Lula’s tapes, Moro appeared on presidential polls with 9 percent backing, a notable level of support for a non-politician, indicative of his continuing popularity. If Brazil gets an Italian solution—the destruction of the major parties—Moro would be well placed to run for the presidency. Influential public figures unscathed by the scandal, such as dominant media players, may benefit as well. After all, it was the removal of the traditional parties in Italy that created an opening for media mogul turned Prime Minister Silvio Berlusconi. It will therefore be important to watch how Globo reacts to any deal to preserve today’s parties.

The first scenario is the more promising for the future of Brazilian democracy, even if it means maintaining parties that have harbored corruption. This path will involve punishing more harshly systemic corruption at Petrobras. On the basis of plea bargains, Moro sharply reduced sentences of Petrobras officials from a total of 283 years to just 6, limiting the deterrent effect of prosecution. Furthermore, if the political system is to endure, the parties must adopt a new, less compromising approach to financing electoral campaigns.

Meanwhile, the judiciary needs to ensure that corruption investigations do not violate the rule of law. In other words, Moro will have to decide whether he is a politician—committed to winning popularity, burnishing his media image, and defeating opposing parties—or a judge, prepared to follow the rules and apply them equally.