On 14 January 2015, police agent Newton Ishii was waiting in Rio de Janeiro’s Galeão airport to meet the midnight flight from London. His mission was simple. A former executive of Brazil’s national oil company, Petrobras, was on the plane. Ishii was to arrest him as soon as he set foot in Brazil and take him for questioning by detectives.

No big deal, the veteran cop thought as he ticked off the hours in the shabby Terminal One lounge. This was just one of many anti-bribery operations he had worked on. Usually they made a few headlines, then faded away, leaving the perpetrators to carry on as if nothing had happened. There was a popular expression for this: acabou em pizza (to end up with pizza), which suggested that there was no political row that could not be settled over a meal and a few beers.

When the plane finally landed, Ishii’s target was easy to identify among the passengers in the arrivals hall. Nestor Cerveró has a strikingly asymmetrical face, with his left eye set lower than the right. “He couldn’t believe it. He said I had made a mistake,” Ishii recalled later. “I told him I was just doing my job and that he could take up his complaints with the judge.”

Cerveró called his brother and a lawyer. He expected to be free before morning. Ishii, too, had few illusions that his suspect would be locked up for long. Decades on the force had taught him how quickly the rich and powerful could wriggle off the hook. There was little reason to think this case would be any different.

As it turned out, both men were wrong.

The investigation that led to Cerveró’s arrest – codenamed Lava Jato (Car Wash) – was about to uncover an unprecedented web of corruption. At first, the press described it as the biggest corruption scandal in the history of Brazil; then, as other countries and foreign firms were dragged in, the world. The case would go on to discover illegal payments of more than $5bn to company executives and political parties, put billionaires in jail, drag a president into court and cause irreparable damage to the finances and reputations of some of the world’s biggest companies. It would also expose a culture of systemic graft in Brazilian politics, and provoke a backlash from the establishment fierce enough to bring down one government and leave another on the brink of collapse.

Launched in March 2014, the operation had initially focused on agents known as doleiros (black market money dealers), who used small businesses, such as petrol stations and car washes, to launder the profits of crime. But police soon realised they were on to something bigger when they discovered that the doleiros were working on behalf of an executive at Petrobras, Paulo Roberto Costa, the director of refining and supply. This link led prosecutors to uncover a vast and extraordinarily intricate web of corruption. Under questioning, Costa described how he, Cerveró and other Petrobras directors had been deliberately overpaying on contracts with various companies for office construction, drilling rigs, refineries and exploration vessels. The contractors they were paying had formed an agreement to ensure they were guaranteed business on excessively lucrative terms if they agreed to channel a share of between 1% and 5% of every deal into secret slush funds.

Oil executive Nestor Cerveró, whose arrest marked a turning point in the Car Wash corruption investigation. Photograph: Evaristo Sa/AFP/Getty

After diverting millions of dollars into those funds, Petrobras directors then used them to funnel money to the politicians who had appointed them in the first place, and to the political parties they represented. The main objective of the racket – which fleeced taxpayers and shareholders out of billions of dollars – was to fund election campaigns to keep the governing coalition in power. But it wasn’t just politicians who benefited. Everyone connected to the deals received a bribe, in cash, or sometimes in the form of luxury cars, expensive art works, Rolex watches, $3,000 bottles of wine, yachts and helicopters. Huge sums were deposited in Swiss bank accounts, or laundered via overseas property deals or smaller companies. The means of transfer were deliberately complicated, in order to hide the money’s origins, or low-tech, to keep it off the books. Prosecutors discovered that elderly mules were flying from city to city with shrink-wrapped bricks of cash strapped to their bodies.

Petrobras was no ordinary company. As well as having the highest market valuation (and the largest debts) of any corporation in Latin America, it was a flagship for an emerging economy that was trying to tap the biggest oil discovery of the 21st century – huge new oil fields in deep waters off the coast of Rio de Janeiro. Petrobras accounted for more than an eighth of all investments in Brazil, providing hundreds of thousands of jobs in construction firms, shipyards and refineries, and forming business ties with international suppliers including Rolls-Royce and Samsung Heavy Industries.

Petrobras was also at the centre of Brazil’s politics. During the 2003-2010 presidency of the Workers’ Party leader Luiz Inácio Lula da Silva (known as Lula), executive posts in Petrobras were offered to Lula’s political allies, to help build support in Congress. Petrobras’s commercial and strategic importance was such that the US National Security Agency made it a target for surveillance. As the Car Wash investigation was to prove, if you could unravel the secrets of this company, you would unravel the secrets of the state.

First, though, investigators had to get executives to talk. Until very recently, that would have been unthinkable. A culture of impunity had long reigned in Brazil. But times were changing, as Petrobras executive Nestor Cerverò was about to find out. When he saw the state of the mattress in the airport detention centre, he threw a tantrum. “How am I going to lie on this?” he said.

“It’s either that or sleep standing up,” Ishii replied. Within an hour, Cerverò had dozed off, only to be shaken out of his slumber at 6am.

“Where’s my breakfast?” he demanded.

“You’re not getting one,” Ishii answered. “I’m taking you to Curitiba.”

Curitiba, the heart of the Car Wash investigation, is the capital of the southern state of Paraná. By Brazilian standards, at 845km it is not far from Rio, but culturally, they are worlds apart. Curitiba is known as the “London of Brazil” because its people are considered more inclined to be sticklers for the rules than residents of the bigger cities in the north. In recent years, it has won international praise for its pioneering public transport system, environmental policies and hipster scene. Thanks to Operation Car Wash, however, it is now best known for its judges, prosecutors and police.

Without one simple reform, however, the investigation might never have taken off. Dilma Rousseff took over from Lula as leader of the Workers’ Party and became president of a coalition government after the 2010 election. In the wake of nationwide anti-corruption demonstrations in 2013, Rousseff had tried to placate an angry public by fast-tracking laws aimed at rooting out systemic fraud. New measures included, for the first time in Brazil, plea bargaining: prosecutors could now make deals with suspects, reducing their sentences in return for information that could lead to the arrest of more important figures.

Overseeing the case in Curitiba was Sérgio Moro, an ambitious young judge who helped prosecutors put pressure on suspects by approving lengthy “preventive detentions”. In the overwhelming majority of cases, Brazilian prisoners remanded in custody before trial are poor. Moro took the unusual step of also denying bail to the rich. Ostensibly, he did so to stop them using economic or political influence to escape any charges against them. However, the pressure was on them: make a deal or stay in jail.

Cerveró was not the first to face this choice. He joined a parade of VIP Car Wash suspects – corporate executives, wealthy entrepreneurs and, later, even one or two powerful politicians – who spent months inside the Curitiba detention centre. They had to be kept separate from other inmates for their own safety, which meant their side of the jail quickly became overcrowded. Having lived in luxury, these super-rich prisoners were squeezed three to a one-man cell. Their new circumstances came as a shock. “One guy did not know how to shave because he had always had it done for him,” said a guard, who asked to remain anonymous. Cerveró apparently had serious problems adapting. His cellmates complained that he urinated on them in the night and washed his backside in the sink.

Brazilian police officer Newton Ishii, who became a hero to many for his role in the Car Wash investigation. Photograph: Hedeson Alves/EPA

If inmates refused to cooperate with the prosecution, privileges such as TV and exercise were withdrawn. “Many suspects made deals after a visit from their loved ones,” said the guard. “I think it was because they smelled the perfume and soap of the lives they had left behind.” Some resisted for months, others just days. But almost all of them broke in the end.

Defence lawyers complained, with some justification, that these tactics were legally dubious and unethical, because defendants would say or do anything to get out of jail. But polls indicated the public was delighted that the age-old problem of corruption was finally being exposed in a major nationwide operation. Almost every day, details of a dawn raid by police or another shocking allegation were splashed across the front pages: more than $2bn siphoned off Petrobras in bribes and secret payments for contract work, $3.3bn paid in bribes by the construction firm Odebrecht, more than 1,000 politicians on the take from the meat-packing firm JBS, 16 companies implicated, at least 50 congressmen accused, four former presidents under investigation.

As the staggering scale of the skulduggery emerged, many Brazilians focused their fury on politicians – initially Lula, Rousseff and others in the Workers’ Party. The newspapers trumpeted the message that the dirty socialists in Brasilia were wholly responsible for the problem. The reality was considerably less clear-cut. Just about every major party was involved in multiple, interconnected trails of corruption going back to earlier governments. And it was the Workers’ Party that had put in place the judicial reforms that allowed the investigation to go ahead. There would have been no Car Wash if the government had not appointed, in September 2013, an independent attorney general.

Newspaper columnists contrasted the dirty world of politics with the high-minded work of the judiciary in the “Republic of Curitiba”. When Judge Moro walked into a restaurant, people would stand up and applaud. Graffiti on walls and banners draped from apartment balconies declared “God save Moro”. Protesters in the streets held up placards declaring “Moro for president”. The federal police also won praise. Ishii became the public face of the investigation: as the officer charged with taking suspects from the airport to the detention centre and the courthouse, he was in almost every picture and video related to the case. On social networks and in headlines, he was nicknamed Japones Bonzinho (the Good Japanese). At carnival, he was honoured with a six-metre-high doll and a samba tribute song, with lyrics imagining a suspect who wakes to find he is the latest target of Operation Car Wash: “Oh my God, I am politically dead! Knocking at my door is the Japanese fed.”

Carnival masks made in the likeness of Newton Ishii. Photograph: Felipe Dana/AP

In person, Ishii is circumspect and austere. When I visited him at his modest apartment in Curitiba, he was careful to downplay his role. He explained that his celebrity had reached the point where he felt trapped. At one public event, he was mobbed by adoring members of the public and had to be escorted out by security guards. A traffic cop pulled him over to ask for his autograph. Bizarrely, even the relatives of the Car Wash prisoners would ask him to share selfies and say how much they admired his work.

Ishii said he realised Car Wash was something special when he saw wealthy businessmen not just go to jail, but stay there. “That’s when the penny dropped. I began to think, hey, I’m in a country where there is an expression, ‘Only the poor get arrested’ – but here are these millionaires getting thrown in prison.”

More was to come. From corporate executives, Car Wash investigators turned their attention to politicians. Dishonest and venal senators and congressmen had long been protected by the immunity of office. But a window for prosecution was opening. The judiciary was in the ascendant, the electorate was mad as hell, and old loyalties were starting to crack. All the prosecutors needed was a little leverage.

To lure one of Brazil’s most powerful politicians out into the open, prosecutors planned a sting operation, using Petrobras’s Nestor Cerveró as bait. Senator Delcídio do Amaral, the Workers’ Party leader in the upper house, was an old associate of Cerveró. They had worked together at Petrobras between 2000 and 2001. After that, Cerveró had become Amaral’s faithful servant, raising illegal contributions for whichever party the fickle senator was aligned with. After Cerveró’s arrest, Amaral knew he was at risk of exposure. Desperate to find a way to discourage him from talking, Amaral arranged to meet Cerveró’s son, Bernardo, in Brasilia.

On 4 November 2015, Amaral met with Bernardo Cerveró at the Royal Tulip Hotel. Unaware that Bernardo was secretly recording the conversation, the senator made a number of incriminating statements, which were later leaked to the press. Amaral offered to pay $1m upfront, plus a further $13,000 a month, in exchange for Nestor Cerveró’s silence. When this was rebuffed, he said he could arrange Bernardo’s father’s escape from prison.

“How?” Bernardo asked.

First, Amaral explained, he would use his influence on a particular judge to arrange for Cerveró to be moved from his prison cell and placed under house arrest. Then, he described in detail how the prisoner’s electronic tag could be deactivated, so he could flee undetected. Cerveró could then charter a private plane to neighbouring Paraguay. Amaral would arrange the whole thing.

As soon as the judges heard the recording, they ordered the senator to be detained on charges of conspiracy to obstruct justice. It was a momentous decision. No sitting senator had been arrested in 30 years.

Amaral was taken into custody on the morning of 26 November 2015. He immediately agreed to co-operate with investigators and tell them everything he knew about the illegal activities of his fellow politicians, including the then president Rousseff, who he accused of conspiring to obstruct justice. He singled out former president Lula as the mastermind of the Petrobras corruption scheme.

The senator claimed it was Lula who had organised the payoffs and urged him to get Cerveró out of the country, because he wanted to protect a close friend who had been involved in negotiations between politicians and oil company officials. Lula and Rousseff denied the allegations and accused Amaral of lying to save himself. “I never imagined he was such a scrotum,” Jaques Wagner, Rousseff’s former chief of staff, told Lula in a phone call recorded by police. But while his critics accused him of spectacular betrayal, Amaral painted his testimony in a heroic light, saying he was doing the nation a favour by exposing the powerful to justice.

“Because I was someone who was talking to the government, talking to parliament, talking with leading Brazilian businessmen, talking to Petrobras, with Eletrobras, with all the state, I had no doubt that my collaboration would be a watershed in the investigation,” Amaral told me in an interview last summer.

Thanks to his cooperation, Amaral was living under house arrest in his brother’s luxurious mansion in one of São Paulo’s swankiest neighbourhoods. When I arrived to meet him, a maid answered the door and led me past a pool and an outdoor jacuzzi to a private bar decorated with neon signs for Coors and Miller beer, a Wurlitzer jukebox and celebrity memorabilia: Ayrton Senna’s F1 racing helmet, Mike Tyson’s boxing glove, Buzz Aldrin’s framed autograph and Eric Clapton’s guitar.

Amaral left open the possibility that he would make a return to politics. The system needed to change, he argued, because corruption had become ingrained from long before the Workers’ Party took power.

Brazil’s political scene is highly vulnerable to corruption. With dozens of parties and elections at three levels (federal, state and city) across one of the world’s largest countries, campaigns are extremely expensive and it is almost impossible for any single political group to secure a majority. Gaining power involves winning elections and paying other parties to form coalitions, both of which require huge sums of money. As a result, one of the greatest prizes in Brazilian politics has long been the power to appoint senior executives at state-run companies, because each executive could expect to receive millions in kickbacks from contractors, much of which could be siphoned off into campaign coffers.

Former Brazilian presidents Dilma Rousseff and Luiz Inácio Lula da Silva. Photograph: Mario Tama/Getty Images

The Workers’ Party was supposed to be different. It had been elected on a promise to clean up corruption, but it soon got sucked in. After winning the presidency on his fourth attempt, in 2002, Lula had been stuck with a minority in Congress. His chief of staff bought the support of minor parties by arranging monthly payments, known as mensalão, mostly paid by construction firms in exchange for building contracts. Although illegal, this allowed the Workers’ Party to get things done. Lula’s first term delivered impressive progress on alleviating poverty, social spending and environmental controls. None of the subsequent three Workers’ Party administrations came close to achieving as much. Unfortunately, because Lula’s reforms had only got through parliament with the aid of bribery, those achievements were built on ethical quicksand.

When the mensalão scandal was revealed in 2004, the Workers’ Party had no choice but to stop paying its coalition partners, and Lula was again stuck with a minority in Congress. Worse, he now faced the danger of being impeached. To prevent this, he reached out to one of his party’s biggest rivals: the Brazilian Democratic Movement Party (PMDB), led by Michel Temer. This marriage of convenience was doomed from the start.

The PMDB is Brazil’s biggest political party, but has never taken an ideological stance or a leadership role, preferring to do deals to shore up governments. It is a mishmash of factions, ranging from conservative rural landowners and urban social democrats to evangelical nationalists and former guerrillas, whose only common ground is a desire to secure the patronage, prestige and bribes that come with government posts. The party has been involved in every corruption scandal in modern Brazilian history. But Lula was desperate, so he struck a deal. In return for support in Congress, the Workers’ Party gave Temer’s PMDB control of the international division of Petrobras and the funds that flowed from it. Cerveró, then the director of that division, was required to deliver payoffs to different masters. It was a gruelling task. In 2008, Cerveró failed to deliver sufficient funds and he was forced to stand down.

Temer has been named countless times in Car Wash testimonies. Julio Camargo, a consultant for the Toyo Setal construction and engineering company, said money was channelled from Petrobras to a lobbyist representing senior PMDB figures, including Temer. One industrialist testified that Temer had arranged illicit payments into the party’s campaign coffers, and had taken leadership of the PMDB in order to control who got the millions of dollars that were being siphoned off from Petrobras, Odebrecht and their suppliers. A former Odebrecht vice president, Cláudio Melo Filho, testified that in 2014, he secretly donated 10m reais (£2.3m) to Temer’s political campaign.

“This bomb could end in his lap in a more serious way than for Rousseff. He’s more involved than her,” a source said.

Temer – a constitutional lawyer – publicly denied the allegations, saying suggestions of illegality were “frivolous” and “untruthful”. Despite the long list of accusations, almost none stuck. Other testimonies against him were withdrawn. No charges were filed. Prosecutors said there was not enough evidence. Temer seemed untouchable.

By the start of 2016, the economy had plunged into recession. The main cause was a collapse in global commodity prices, but the Car Wash investigation made a bad problem worse. Prosecutors had ordered Petrobras to suspend business with many of its contractors, including Odebrecht, the biggest building firm in Latin America. Projects were paralysed, workers were laid off and the unemployment rate almost doubled in the space of two years. Political activity was also paralysed. The arrest of Amaral had shaken congressmen out of the assumption that they could rely on their positions to avoid prosecution, and relations between parties became more hostile.

Senator Amaral told me he had warned President Rousseff repeatedly of the dangers of pushing too far with the Car Wash investigation, but she would not listen. “She always underestimated Car Wash, because she thought it would reach everyone but her,” he recalled. “She thought it would make her stronger.”

A majority of the public blamed the economic misery and political gridlock on the Workers’ Party, which had been in power for 13 years. Rousseff’s approval ratings slipped into single digits. She was even more unpopular in Congress, owing to her woeful communication skills, secretiveness and stubbornness. Several powerful senators and deputies – the Brazilian Congress has two houses, the upper Federal Senate and the lower Chamber of Deputies – were also furious that the president refused to halt the corruption investigation, or to protect senior members of her ruling coalition.

The bid to oust Rousseff as head of state was initiated in November 2015 by one of the most corrupt politicians in the country, Eduardo Cunha, in an attempt to stop or divert Car Wash. Cunha, the speaker of Brazil’s lower house, was an ally of Temer in the PMDB, with a reputation for scheming and underhand tactics. He was also a chief target of the Car Wash prosecutors. As evidence piled up through 2015, they accused him of corruption and perjury after uncovering his secret Swiss bank accounts, which contained more than $5m dollars and credit card bills bearing witness to a lavish lifestyle far beyond his declared income of $120,000. The Workers’ Party refused to protect Cunha against charges brought by the lower house ethics committee. Cunha hit back by granting one of the many impeachment requests against Rousseff. It accused Rousseff of false accounting – shifting significant funds between accounts to make government finances look better than they were. Many previous administrations had done the same thing with impunity, albeit not on such a great scale. But that was not the point. The targets of Car Wash needed a pretext on which to strike back.

On 4 March 2016, prosecutors briefly detained Lula for questioning about the Petrobras kickback scheme. There were additional allegations of influence peddling, including deals secured for Odebrecht in return for generous payments to companies owned by Lula’s relatives. Millions of anti-government protesters took to the streets a week later, on 13 March, bearing inflatable dolls of Lula in prison clothing, chanting “Fora Dilma” (Rousseff Out!), carrying banners and shaking brooms to symbolise the need for a clean sweep.

Inflatable effigies of Dilma Rousseff and Luiz Inácio Lula da Silva at a protest in São Paulo in April 2016. Photograph: Cris Faga/CON/Latin Content/Getty

Lula and Rousseff had undoubtedly benefited from the corruption politically, but it is less clear – particularly in Rousseff’s case – that they had gained personally. By contrast, the hypocrisy of many of their accusers was staggering. At a parliamentary impeachment session in April, many of those who voted to eject Rousseff from office had themselves either been charged or were under investigation for far more serious crimes.

In May, as impeachment proceedings against Rousseff continued, Michel Temer became interim president, even though he was mentioned multiple times in the Car Wash investigation, along with seven members of his cabinet. Critics speculated that Temer was being protected to ensure a degree of stability during a period of turbulence. Even when Temer was found guilty in June 2016 of election violations and disqualified from running for office for eight years by a lower court judge in São Paulo, it made no difference. As interim president, he was shielded by the immunity of office. Car Wash, which had been launched to clean up corruption in the system, had ended up helping the leader of Brazil’s most notoriously self-serving party to reach the pinnacle of power.

Rousseff’s supporters called it a coup, though the impeachment had been approved by the largely Workers’ Party-appointed supreme court, as well as large majorities in both houses. Temer insisted the letter of the law had been followed. “Brazil has gone through a difficult period of political disputes, but the Constitution has been honoured,” the new president insisted. Soon after, however, it became clear that many of his supporters had been motivated by self-preservation rather than national salvation.

In Temer’s first month as president, three more of his ministers were forced to resign as a result of secretly recorded phone conversations, which confirmed Rousseff had been ousted because she would not call off the Car Wash investigation.

“We have to stop this shit … We have to change the government to be able to stop this bleeding,” one of the chief plotters, Romero Jucá – the PMDB leader in the upper house – told Sérgio Machado, the former president of Transpetro, Brazil’s largest oil and gas transportation company. Unknown to Jucá, the conversation was being recorded. In that call, in March 2016, Jucá revealed that he had discussed the plan with supreme court justices and military commanders: the aim was to usurp Rousseff and replace her with Temer. Jucá maintains that his words were taken out of context.

But getting the Workers’ Party out of government was only the first step in stopping Car Wash. The conspirators had another problem: Teori Zavascki, the supreme court justice overseeing the investigation, who had proved to be incorruptible.

“One way (to halt the operation) is to find someone who has access to Teori, but it seems there is no one,” says Machado in the recording.

“He’s closed off,” Jucá agrees.

This obstacle did not stay in place for long.

During a thunderstorm on 19 January 2017, a Hawker Beechcraft twin-prop aircraft crashed into the ocean near Paraty, 150 miles west of Rio de Janeiro, killing all four people on board. The plane was on its way from São Paulo to Rio. It might have been seen as just another aviation accident, were it not for the fact that one of the victims was judge Teori Zavascki.

The timing and nature of the crash inevitably raised suspicions. Zavascki was in the process of reviewing numerous Car Wash testimonies that were expected to further implicate politicians in Brazil and other countries in Latin America. His family said he had received threats the previous year.

Initial findings from the plane’s wreckage and the cockpit voice recorder suggested there was no mechanical failure. The pilot was experienced and had given lessons to other aircrews on how to land on the small airstrip at Paraty. But small planes have a terrible safety record in Brazil. Speculation in the media suggested that either the pilot had made a fatal misjudgment of altitude or the plane and its passengers were victims of foul play.

Whatever its causes, the consequences of the crash were far-reaching. Zavascki had maintained the investigation’s credibility in the face of fierce political opposition, and he had ruled on some of its most contentious cases. On hearing news of the judge’s death, Moro said: “Without him, there would be no Operation Car Wash.”

Judge Sérgio Moro, who relentlessly pursued prosecutions in the Car Wash case. Photograph: Brazil Photo Press/CON/LatinContent/Getty Images

Zavascki exemplified the idealistic and ultimately self-sabotaging stance of the Workers’ Party in its relationship to the justice system. After the party took power, judges, prosecutors and police were given far more scope to act. Under the previous conservative administration, the attorney general had filed away so many incomplete investigations that he was nicknamed the engavetador general (shelver-in-chief). Lula, by contrast, let prosecutors elect a new attorney general – Rodrigo Janot – who was so independent that he approved the charges against Lula, the Workers’ Party founder.

“Before Lula took power, we were toothless,” said Luis Humberto, of the Federal Police union. “The Workers’ Party increased our budget, upgraded our equipment and gave us more authority. It is ironic. They lost power because they did the right thing.”

Temer chose one of his close allies to replace Zavascki. Alexandre de Moraes, who was justice minister, went straight from the cabinet to the highest court. It was a clear violation of the constitutional principle of a separation of powers. Several of the senators who confirmed his appointment were ministerial colleagues – including Jucá, and the head of the upper house, Renan Calheiros – who have been charged in the Car Wash case. When a supreme court judge ordered Calheiros to step down while he was awaiting trial, Calheiros simply ignored him. Moraes, who lacked any experience as a judge, is now one of 11 supreme court justices who will hear his case.

In Congress, meanwhile, the PMDB-led ruling bloc have repeatedly attempted – so far unsuccessfully – to change the law so that testimonies resulting from plea bargains are no longer admissible in court. This would enable dozens of politicians to escape possible conviction.

So far, Car Wash investigators have resisted political pressure and expanded their list of targets. After shifting focus from Petrobras to Odebrecht, in April 2017 prosecutors opened new probes into dozens more politicians from all sides of the political spectrum, including eight members of Temer’s cabinet. They then widened their net to include JBS, one of the world’s biggest meat-packing firms. A plea bargain made on 18 May by the two brothers who own the company – Joesley and Wesley Batista – includes secret recordings allegedly made in March, in which Temer allegedly discusses hush-money payments to Cunha, and details of bribery by one of the president’s aides. The attorney general has now formally accused Temer of conspiring to obstruct Car Wash, setting the stage for a constitutional battle between the judiciary and the government and prompting calls in Congress for the impeachment of a second president in a year. Temer denies the charges.

The web of corruption has been traced far beyond Brazil’s borders. Odebrecht had a department dedicated to bribes, known as the Division of Structured Operations, which laid out close to $800m in illicit pay-offs for more than 100 contracts in a dozen countries over 15 years. Dozens of foreign corporate suppliers (of engineering equipment, power lines, drilling rigs and so forth) also face regulatory and shareholder inquiries about the bribes they paid to secure contracts with Petrobras. Among them was Rolls-Royce, which posted hefty losses as a result of penalties imposed in January this year by Brazilian, UK and US authorities. The World Cup and Olympics have also been sucked into the mire with fraud investigations now focused on six out of the 12 stadiums used in 2014 and 2016.

The investigation has shaken political and economic life and raised hopes that, for once, justice will be applied to the rich and powerful. There was a genius in the way Ishii’s arrest of Cerveró paved the way for trials of politicians. Several previously untouchable senators, congressmen and governors are now in jail, including Cunha. Powerful businessmen have also been put behind bars, including Marcelo Odebrecht, the head of the vast construction firm. Even the celebrity cop Ishii was suspended from the Car Wash investigation after he lost an appeal against an old bribery charge. More than at any time in Brazil’s recent history, there is a genuine sense that nobody is above the law, that scandals do not always have to “end in pizza”.

A photograph of Michel Temer, president of Brazil, on a mock coffin during a protest in Rio de Janeiro last month. Photograph: Bloomberg/Getty

The story is by no means over. Attorney general Rodrigo Janot, who is due to leave office in September, is under pressure. Mainstream parties from the left and right are lined up against the investigation. The government is trying to hamper Operation Car Wash by slashing the federal police budget by 44% and reducing the number of agents working on it. Moro must keep the public on his side as he begins a series of trials of Lula, who plans to run for president again in 2018 if he is not jailed.

Brazil certainly needed to tackle corruption, which has exacerbated inequality and held back economic growth. But was Operation Car Wash worth the pain? It helped to lever the Workers’ Party out of office, and ushered in an administration that appears just as tainted, but far less willing to promote transparency and judicial independence. So many allegations are now stacked up against Temer and his allies that he will struggle to hold on to his presidency until the end of his term in 2018. Petrobras – the national champion of the Lula era – has been brought to its knees, with foreign companies allowed to control production from the new oil fields. Major companies and mainstream politicians have been utterly discredited. Voters struggle to find anyone to believe in. It is not just the establishment that is reeling, but the entire republic.

In the long term, many still hope Car Wash will ultimately make Brazil a fairer, more efficient nation, run by cleaner, law-abiding politicians. But there is also a risk that the operation will shake the country’s fragile democracy to the ground and clear the way for a rightwing evangelical theocracy or a return to rule by dictators. Whether or not this purge proves a cure for Brazil will depend not just on who falls, but on who follows.

Additional research by Shanna Hanbury and Gareth Chetwynd. Main illustration by Suzanne Lemon.

• Follow the Long Read on Twitter at @gdnlongread, or sign up to the long read weekly email here.