As Bob Mueller’s special-counsel investigation deepens and Americans across the country increasingly find themselves debating the definition of “collusion” over dinner (and wondering just what might happen if the president actually did try to fire the investigator), one can be forgiven for overlooking that the largest corruption case in history came to light recently and has nothing to do with Donald Trump or Vladimir Putin. It’s the biggest foreign bribery scheme of all time, and it’s still unfolding — in Brazil.

The scale of corruption is breathtaking: The current president, four former presidents, and more than 100 federally elected politicians total are either in jail or under investigation. Imagine if a single corruption investigation and its offshoots netted Donald Trump, Barack Obama, Mitt Romney, Paul Ryan, George W. Bush, Bill Clinton, and George H.W. Bush and you begin to get the picture.

But the Lava Jato, or Car Wash, investigation isn’t just a comically large political scandal in Brazil. It also contains interesting parallels and lessons for close observers of American disarray — as well as those concerned about global democracy’s trend lines.

Those lessons include reminders that action through the courts can ultimately catch up to charismatic leaders no matter the political climate of the day; that true outsiders can still force change; that the legal process can be painfully slow, but when it bears fruit it can do more than take down a leader, it can also destabilize an entire political system while offering few political solutions for how to put the pieces back together; and, finally, that as democracy’s credibility suffers globally and authoritarian regimes increasingly assault democratic norms, the path that the United States, Brazil, and the world’s other leading democracies chart in responding to the wave of populist anger in the world will be critical to determining the future contours of contemporary democracy. Often, it seems, that path will be charted through the courts.

So what exactly did happen in Brazil? In many ways, Brazil’s story is that of the exhaustion of a political system forged when the country transitioned in the mid-1980s from dictatorship to democracy. That transition led to meaningful socioeconomic gains and the country’s renewed projection on the global scene, but it also created an unwieldy system of coalitional presidentialism — Brazil’s executive has vast powers, but must contend with a legislature of more than 30 political parties that often seem as motivated by personal political gain as principle or ideology. The result is a lack of accountability and a governance structure that frequently makes bribery the only way of asserting effective political control of the country.

But let’s back up a little — to 2005.

2005: The Mensalão scandal strikes

The unmasking of Brazil’s corruption started in earnest in 2005. The story of the Mensalão, or big monthly payment scandal, emerged when a congressman revealed that the ruling Workers’ Party (PT) was paying generous monthly allowances to congressional members in exchange for favorable votes on the PT’s legislative priorities. Despite the serious allegations and forced resignations of several key advisers to then-President Lula, the political consequences were not particularly severe.

Why? The short answer is: The economy was booming, and the president’s supporters were really loyal. Under decades of Lula’s charismatic leadership, the PT successfully leveraged its historic role in ending the military dictatorship, its opposition to Brazil’s traditional political elites in favor of the working masses, and Lula’s own humble upbringing to forge a reputation as the country’s only party of principle. Mensalão alone did little to dent the party’s shine — Lula coasted to reelection just a year after the scandal broke and Dilma Rousseff, Lula’s handpicked successor, later won two more presidential elections.

2010: The economy peaks, then starts to stall

A number of factors (chiefly the seemingly insatiable demand from countries like China for key Brazilian export commodities like iron ore, oil, and soybeans) contributed to impressive growth in Brazil through much of the 2000s. The economy topped off in 2010 when the country’s gross domestic product (GDP) grew by the China-esque pace of nearly 8 percent, and did so just as the rest of the world was suffering through the trough of the Great Recession.

The PT leveraged the boom to expand social initiatives that provide monthly cash transfers to poor families who keep their children in school and ensure they have medical checkups. The program reduced extreme poverty while providing for improved health and education indices. In parallel, Brazil’s national development bank rapidly expanded its loaning activities to Brazilian business. Brazil’s currency soared and the country became a model for a developing world on the lookout for recipes of inclusive growth. The PT believed it had found a winning political formula that achieved an equilibrium of sorts between big Brazilian business, the political left, and the country’s working classes.

The formula came under strain, however, as the economy started to suffer. The price of commodities began to drop due to lingering effects from the Great Recession, and growth began to taper. By 2014, the country had entered into what would be a three-year recession and Brazilian attitudes about the PT and the corruption scandal were hardening.

2012: Mensalão reaches the Supreme Court

Of course, political outcomes and legal consequences are different things. Though the PT had stayed in power throughout the news of the scandal, it definitely was not in the clear (something else for Americans to perhaps keep in mind). It took seven years, but in 2012, the criminal investigation into Mensalão finally worked its way through Brazil’s besieged judiciary and reached the Supreme Court, which has jurisdiction over any criminal allegations involving cabinet members or federally elected officials. The trial was broadcast on Brazilian television and transfixed the public, and it turned Chief Justice Joaquim Barbosa — the first and only Afro-Brazilian judge to ever serve in the Supreme Court — into a kind of prosecutor-hero.

Ultimately, 12 defendants received jail sentences. It was the first time the Brazilian Supreme Court actually sent prominent politicians to prison. “There is a saying in Brazil that jail is only for pretos, pobres e putas, or blacks, poor people or whores,” explains Paulo Sotero, director of the Brazil Institute at the Woodrow Wilson International Center for Scholars. Not anymore. Barbosa’s stewardship of the case created a series of powerful and symbolic vignettes that bestowed upon him a legitimacy in the eyes of Brazilian society that began to break the political back of the PT.

2013–2014: Sérgio Moro and the Nine Horsemen of the Apocalypse seize their moment

That might have been it — an unprecedented but circumscribed prosecution. But as Mensalão staggered along, a talented group of judges and prosecutors hailing from the provincial southern state of Paraná were preparing themselves for the next phase in the corruption fight. They include Sérgio Moro, the federal judge overseeing the Lava Jato investigation, as well as a group of prosecutors investigating Lava Jato known in Brazilian media as the “Nine Horsemen of the Apocalypse” for their efforts to bring down Brazil’s old power structures.

The group drew inspiration from the plea bargains used to indict the U.S. Mafia and corrupt Italian politicians in Italy’s infamous 1990s Mani Pulite case. As the Mensalão scandal was taking off, Moro finished presiding over an unsuccessful laundering case involving the state bank Banestado. In that case, Moro could not use plea-bargaining deals like in America to induce executives to turn on each other because Brazil’s 1988 Constitution neutered plea bargains: Defendants could remain at liberty while the overburdened judiciary considered every legal recourse, which often takes years. The provisions were intended to end illegal detentions characteristic of the dictatorship, but they had actually created a de facto system of impunity.

Those involved in Banestado had hoped for better results, but they would be well positioned to draw from their experiences and advance their agenda at the next politically opportune moment, which came several years later with the government’s response to the 2013 political crisis.

2013: Brazil Takes to the Streets & Brasilia Panics

In part because of its sustained economic boom, Brazil was chosen to host the 2014 World Cup and 2016 Olympics. Almost simultaneously, it made one of the world’s largest deepwater oil discoveries off its coast, adding to the sense that the series of sporting events would be a national coronation of Brazil’s global rise.

That series kicked off in 2013, when the Confederations Cup soccer tournament — always staged a year before a World Cup as a kind of test run — generated massive street protests animated by a sense that the growth Brazil was trumpeting so proudly hadn’t actually been all that equitably distributed. On June 20, an estimated 1 to 2 million people across the country protested, with the biggest demonstrations taking place in Rio de Janeiro. Throughout the country, rising bus fares were taken as an opportunity to protest the more general lack of social investment — in schools and hospitals — at a time when the government was spending massively to support its showcase sporting events. As André Basseres, one of 23 leading activists from Rio de Janeiro whose leadership in the protests led to charges of criminal association in a crackdown by city authorities, explains:

“2013 was about something more profound. People began to realize that not much had changed under the PT. Why? Because of this oligarchic pact between big industry and the political elites. The country does not belong to the people, that’s what the protesters felt. And so, you have this totally spontaneous and raw explosion of righteous fury.”

2013–2014: Rousseff flails in response

Dilma Rousseff was no politician. She had never previously won elected office and came across as a cold technocrat who failed to connect both with the masses and the PT’s political allies. The confidence derived from the PT’s decade in power had blinded Rousseff to the street’s growing fervor and she struggled to respond. Rousseff’s approval ratings fell from 57 percent to 30 percent in June alone.

As the protests continued, Senate president Renan Calheiros stepped into the fray, deputizing his staff to identify ten legislative measures that would at least signal that the Senate had gotten the message from the protesters. In a stroke of fate, among these staffers were a group of young activists who had lived through the Banestado scandal. They quietly ensured that plea-bargaining reform was included in the list of initiatives. “In their haste to be responsive,” Matias Spektor, founder of the Getulio Vargas Foundation’s Center for International Relations, explains, “Most of the politicians didn’t realize what they had done in approving the law until it was too late. Once it had become public, politicians could not afford to be seen as being opposed to it.” Rouseff herself would come to criticize the plea bargain measure, despite having signed it into law.

Eventually, “the protests inevitably started to subside,” Basseres explains. “So who stepped in when the streets couldn’t go any further? The judiciary. They recognized at that moment that they were the only actors who felt like they could be the difference.”

2014: Lava Jato

And here we enter the scandal’s final, most dramatic act. In 2014, Moro and the horsemen launched an inquiry into suspiciously large money transactions detected at a gas station in Brasilia (hence the investigation’s name) involving a key money launderer that Moro had unsuccessfully tried during the Banestado case. Moro & Co. had discovered that this launderer was still up to his old tricks, but was now doing so in partnership with an executive at Brazil’s titanic energy company Petrobras (which is majority-owned by the state and a major force in the national economy). This time, however, the horsemen were aided by their new power to actually enforce, and therefore negotiate, plea bargains with those involved.

Both the money launderer and energy executive agreed to cooperate and the inquiry ultimately revealed a scheme in which political parties endorsed particular individuals to sit on the Petrobras board of directors. In return, board members diverted resources to enrich the coffers of these parties and their leaders by artificially inflating the price of lucrative contracts Petrobras put out to bid. Many of Brazil’s largest companies were complicit to ensure their bids would be successful. Thus, Lava Jato not only began to take down Brasilia’s political Establishment, but also Brazilian industry; many previously untouchable titans of Brazilian business came to suffer the consequences.

2016: Rousseff Impeached

Lava Jato hit Rousseff hard. After all, she had chaired the Petrobras board from 2003–10. Although the investigation has not implicated her personally, her professed ignorance of the scheme, despite her proximity to its most influential players, has struck few as credible. At a minimum, many assert, Rousseff must have willfully turned a blind eye. Rousseff had already been weakened by the 2013 protests, but Lava Jato showed that Mensalão had been no exception and that personal enrichment as opposed to legislative corralling was also very much part of the PT’s arsenal. Indeed, Lula himself was eventually sentenced to nearly ten years in prison for allegedly accepting from an engineering company renovations for his beachside apartment worth over $1 million.

Rousseff initially embraced Lava Jato and moved to consolidate her political power over the legislature by fomenting a divisive race between the PT and its largest coalitional partner to determine the next speaker of the lower congressional chamber. But the plan backfired when the PT candidate lost, leaving deep fissures between Rousseff and the party that included her vice-president and leaders of both congressional chambers.

As Rousseff’s popularity ratings dropped to single digits, the pace of the recession quickened, and as Lava Jato progressed, talk of her impeachment grew. Rousseff’s allies “became scared that she either wasn’t willing or was too politically weak to protect them from Lava Jato. They essentially decided that they needed someone much stronger as president,” explains Spektor. The speaker authorized impeachment proceedings in December 2015 by approving a petition accusing Rousseff of cooking the government’s budgetary books to artificially prop up the economy before her 2014 reelection. Ironically, the speaker has now been sentenced by Lava Jato to almost 15 years in prison, but the damage to Rousseff was done.

Rousseff denounced the impeachment effort as a coup. The political Establishment’s dubious motives for favoring it certainly provided fodder for her arguments, but she had also done herself few favors. For example, as Moro’s investigation into Lula progressed, Rousseff decided to appoint him as her chief of staff. The appointment was surely intended in part to leverage Lula’s political talents to stave off growing support for impeachment, but, in an extremely controversial move, Moro publicly released tapes of recorded conversations between Rousseff and Lula that indicated the appointment was intended to shield Lula from Moro by assigning a cabinet-level position that would place him under the Supreme Court’s jurisdiction instead.

The leaked recordings were perhaps the final straw. There was now seemingly irrefutable proof that the highest levels of the PT were no different than any other party. The Senate voted to remove Rousseff from office on August 31, 2016, and swore in Vice-President Michel Temer the same day.

2017: What comes next?

Until now, the story has been one of a small group of judicial actors taking on almost every traditional lever of power in Brazilian society — big business, the Executive and Legislative branches, even elements of the judiciary itself — and winning. Historically, however, the global track record of the judiciary alone instituting a true sea change in political culture is decidedly mixed.

After all, prosecutions and plea bargains can only go so far. It’s all well and good that former national security adviser Mike Flynn has copped a plea with Special Counsel Mueller, for example, but it doesn’t change President Trump’s assault on American institutions, or the American people’s eroding faith in those institutions.

“One only has to look at what came in the aftermath of the Mani Pulite case from which Moro took so much inspiration to see a cautionary tale,” says Spektor. “The case gutted Italy’s political Establishment, but did so only to see an almost immediate return to corrupt governance in the guise of Prime Minister Silvio Berlusconi.”

Sadly, the Berlusconi precedent looms large for Brazil. President Temer remains under investigation for corruption and he has repeatedly attacked the judiciary’s efforts to clean up the country’s politics in his short tenure as president. Furthermore, as Brazil barrels toward its presidential election in fall 2018, polls consistently put Lula in the lead (although he could be prohibited from running if attempts to appeal his conviction prove unsuccessful). Jair Bolsonaro, an extreme-right congressman who is openly homophobic and who has publicly defended rape and torture, routinely polls in second place. Of course, with nearly a year left before the election and Lula’s future uncertain, the field of candidates remains wide open.

It’s just another reminder that efforts to take down governments, or even individual leaders, can leave much bigger vacuums than anticipated (especially if they proceed without broader political buy-in). Whoever wins, Brazil’s election will be an illustrative data point for how democracies respond to the twinned threats of populism and democratic alienation — threats that have left the global democratic model in its most vulnerable state since before the fall of the Berlin Wall. Because of Lava Jato, “the eyes of a nation have been opened,” Spektor explains. “We will now just have to see what the Brazilian people do with this knowledge.”