With their hands up in the air, ministers, four-star generals and International Olympic Committee officials danced to famous samba tunes at the closing ceremony of the Rio Games last August. While carnival was taking over the Maracanã Stadium, politicians hugged each other in the VIP area. It was a moment of relief, after seven years of tension and controversies. The confetti falling over their heads served as a curtain, closing the Rio 2016 Olympics on a high note.

But the drums could not hush up the investigations into allegations of massive bribes related to the two sport events – the World Cup and the Olympics – that were to be used as a joint endeavour to present to the world a new image of Brazil: a modern country, sophisticated and, above all, responsible.

Beyond the debate about the use of the stadiums, legacy and the projection of a young nation, it was the police that took centre stage as soon as athletes from all over the world left the country. Over the seven months that followed, politicians would be arrested and formally accused, while sports officials, judges and many of the venues would be the target of police operations.

What began as an investigation into the former state oil company Petrobras in 2014 soon also became a criminal process about the organisation of the two mega-events, paid for mostly with public funds and presented to citizens as a reason to be proud. The latest release of official documents by the Brazilian federal supreme court, seen by the Observer, shows that the venues were not only cathedrals of new world records but are alleged to have channelled millions of dollars worth of bribes. Brazil’s supreme court opened investigations into around 100 politicians, based on hundreds of hours of testimonies by past and present executives at the construction and chemicals conglomerate Odebrecht. The documents released show that:

■ Six out of the 12 stadiums built for the World Cup are now under investigation for irregularities and bribery.

■ Eduardo Paes, the former mayor of Rio, is accused by a former executive at Odebrecht of having taken R$15m (£3.7m), in exchange for facilitating contracts related to the Olympic Games.

■ The new subway line in Rio, claimed as a key 2016 Olympic legacy, is the target of a police operation for suspicion of fraud.

■ The president of the accountability tribunal of the state of Rio, Jonas Lopes, is being investigated for allegedly accepting bribes in exchange for the approval of the contracts for the Maracanã.

■ Arena Corinthians, the new stadium in São Paulo that hosted the opening match of the 2014 World Cup, has been investigated for “possible criminal practices”. Odebrecht executives claimed it was a “gift” to the country’s former president Lula.

The suspicion reached the man who, for the IOC, was the key to the Rio Games and presented to the world as the face of a new generation of Brazilian politicians. According to the documents released by the supreme court of Brazil, Paes – Rio’s mayor from 2009-16 – is accused of having taken his illicit share from the event. In a speech at Maracanã in August, the IOC president, Thomas Bach, described Paes as “a great leader”.

The allegations contained in the documents released by the supreme court are based on a plea bargain agreement reached with Benedicto Barbosa da Silva Júnior, a former executive at Odebrecht. He has admitted to organising the payment of bribes, in exchange for public contracts.

According to him, his “business group gave over R$15m to Eduardo Paes, in light of his interest in facilitating contracts related to the Olympic Games”. A third of this money was sent to offshore accounts, including in Switzerland, Benedicto Júnior alleged. The former mayor’s press office denies any involvement in the affair and claims the allegations are “absurd”.

The company behind the accusation ended up being awarded the contract to build the Olympic Village, the Olympic Park and the new subway line, among others. Ironically, the athletes’ village was named “Pure Island” by Odebrecht.

The subway line is, in fact, a target of a separate police operation. The suspicion of fraud was brought to light after the bill for it exploded from an original plan of R$880m to R$9.6bn.

Paes’s administration is not the only one in such a situation. Sérgio Cabral, a former governor of Rio and the main cheerleader for bringing the Olympics to Brazil, was arrested in November on corruption charges and is now in prison awaiting trial. Cabral denies any wrongdoing and his lawyers say they will only present his defence and his version of the facts during the trial.

It was during his mandate that the works for the renovation of Rio’s iconic Maracanã were commissioned. Along with Cabral, some of the members of his cabinet were also arrested. Today, the attorney general’s office in Rio is demanding the return of R$200m from the money spent during Cabral’s term in charge of the stadium, claiming fraud and overpricing.

In only one of the items investigated – the installation of air conditioning – the total cost jumped 1,257% during the construction, to a total of R$18.5m. The allegations point to the suspicion that the bribes were not limited to politicians but also to those who were responsible for auditing the contracts.

Based also on plea bargain agreements reached by Odebrecht executives, prosecutors and the police are investigating Lopes – who presided over the body responsible for checking that public contracts are in order – over corruption charges.

Lopes was accused of having asked for bribes in exchange for the approval of the contracts for the Maracanã. Cabral, who denies any wrongdoing, is alleged to have sent a member of staff and a judge to receive R$4m to approve the deal. Lopes also denies the allegations.

Edson Fachin, a member of the supreme court, said in his accusation: “Beyond the transfers of money to the former governor Sérgio Cabral, payments have been identified to the benefit of the agents related to the Accountability Tribunal of Rio.” The final bill for the stadium was R$1bn, 75% above the initial price.

But the Maracanã was not an isolated case. In the plea bargain agreements, a total of six stadiums built for the World Cup are cited by politicians or executives as being part of illegal deals and instruments to transfer bribes.

Caught up in the affair is the fanatical Corinthians fan Luiz Inácio Lula da Silva, known simply as Lula, who was president of Brazil from 2003-10 before being succeeded by his Workers party colleague Dilma Rousseff.

Regarding the stadium used for the World Cup opener between the hosts and Croatia, the supreme court said it would investigate “possible criminal practices associated with the construction of the Corinthians Arena”.

Vicente Cândido, a congressman from Lula’s Workers’ party, is alleged to have received R$50,000 for his job of trying to find a way to allow public funds to pay for the stadium. Cândido is also one of the directors of the CBF, the Brazilian football federation. He has not responded to the claims but the Workers’ party has defended all its members cited in the documents in a statement in which it rejected the “frivolous” allegations.

The congressman Andrés Sánchez, a former president of Corinthians and the main operator of the stadium, is also under investigation. He is accused in the documents released by the supreme court of having received R$3m from the construction company. Cândido and Sánchez deny the allegations.

The opening ceremony for the 2014 World Cup at Arena de São Paulo. The World Cup has become mired in corruption allegations. Photograph: Friedemann Vogel/Fifa via Getty Images

But it was the chairman of Odebrecht, Emílio Odebrecht, who suggested before a federal judge that the entire stadium could possibly be considered as one big bribe. According to Odebrecht, the Corinthians Arena was a “gift” from the company to Lula. The company agreed to pay for part of the construction cost, in recognition for what the government had done for it throughout the years. Between 2003 and 2015, it saw its turnover go from R$17bn to R$132bn during the years when Lula and Rousseff were in power.

Lula’s lawyers have criticised the publication of the content of the plea bargain submissions, arguing that it is part of a campaign to damage his reputation and deny all of the claims. “He has committed no crime,” declared Lula’s defence in a statement to the press. According to them, the accusations are “frivolous and lack any materiality”. “There are only statements and suppositions – and no proof,” they stated.

In his plea bargain agreement, Marcelo Odebrecht – the son of Emílio and the chief executive of the company – repeated a very similar version about the “gift”. “There was a request from Lula to my father: Help Corinthians to have its private stadium.”

In some instances, companies claim that agreements were done even before the government opened its taps to fund the construction of the stadium, with public money. Cartel arrangements were supposedly established to split the contracts. In one of the plea bargain agreements, the Odebrecht executive Ricardo Roth told the judges how his company entered into an understanding with the rival group Andrade Gutierrez to make sure the latter would win the contract to build the stadium in Brasília. It was the most expensive arena ever built in Brazil, with a final bill of R$1.4bn. Lawyers for Gutierrez reject the claims.

This was also said to be the modus operandi at Arena Castelão in Fortaleza and in Manaus, where England lost to Italy in the tropical heat in June 2014. In the case of Recife, João Ferreira, a former Odebrecht executive, said in his plea bargain agreement that different companies reached a deal to “frustrate the competitive aspect of the procurement process”.

On the sports side, some of the officials involved have already been taken to prison. In March, Brazil’s federal police arrested the former president of the nation’s swimming federation, Coaracy Nunes, on charges of diverting public funds from the ministry of sport that were supposed to be used to pay athletes.

In 2016, when he was formally charged, he rejected the claims and insisted that the investigation was a plot from the opposition to take him down from the presidency.

Contracts between the government and 14 different sports federations are also under review, while the president of the CBF, Marco Polo Del Nero, has been indicted in the US in connection with the scandal that brought Fifa to its knees. The Brazilian official denies any wrongdoing and refused to step down.

The statements of Odebrecht executives to judges and prosecutors also suggest the distribution of bribes related to the World Cup and the Rio Games followed neither an ideology nor favoured a political party. What seems to have mattered was the capacity of a specific politician to assure benefits to the company.

This appears to have been precisely the case of Eduardo Cunha, a former speaker of parliament, who was ousted as a result of corruption allegations and sentenced last month to 15 years in prison. He has appealed against the verdict.

Cunha would become, in 2016, the person who orchestrated the successful impeachment of Rousseff amid huge political turmoil in Brazil.

According to statements by the Odebrecht director Benedicto Júnior, Cunha approached him with a very specific demand: he wanted 1.5% of the total value of the works being done at Porto Maravilha, the revitalisation of a historical harbour in Rio presented by the organisers of the 2016 Games as one of the main legacies of the event.

Benedicto Júnior alleges that the company agreed to pay, with the understanding it would have the backing of one of the most influential politicians in the country to assure the smooth transfer of public money to Odebrecht to be able to complete that specific venue.

Benedicto Júnior claims Cunha received R$9.7m in 36 monthly payments between 2011 and 2014. Cunha’s lawyers have told the Brazilian press that the statement is false and was not based on any evidence.

While these bribes were supposedly being paid, the government of Rio was imposing the costs of the mega-events on its own society. To make sure there would be enough funds for infrastructure work connected to the Olympics, authorities decided to delay wage payment of active civil servants in early 2016, as well as to retirees and pensioners of the executive branch. Without any cash in hand to pay salaries for May in full, the state of Rio de Janeiro announced that in effect only 70% of the payroll would be paid on the 14th of that month, with a financial outlay of R$1.1bn. The delay in payment of wages that month affected a total of 393,000 civil servants in administration, hospitals and public schools.

Seven weeks before the opening of the Games, the state of Rio declared a “state of calamity”. The move assured that it received a sum of R$2.9bn from the federal government immediately for expenses brought about by the Olympic and Paralympic Games, and also for the payment of salaries. In addition, these funds would also be used to pay for security and for the completion of Linha 4 of the Rio de Janeiro underground, which would connect the upmarket neighbourhood of Barra da Tijuca to the Ipanema area. This was considered an essential project for the Games to go ahead and was also tainted by corruption.

Three months after the Olympic circus had closed its tent and left the country, the state of Rio de Janeiro gave clear evidence that it was bankrupt. In November 2016, the state government came up with a proposal that showed the sheer extent of the crisis, as well as who would have to foot the bill. Pensions started to be taxed, social programmes were cut and salary increases were cancelled.

Overall, the economy of Brazil entered its worst recession, with unemployment affecting 13 million people.

As politicians and businessmen are put in jail and the economy is ruined, a statement by the IOC’s Bach at the closing ceremony in Rio still resonates in the country. According to him, having held the Games in such a difficult political climate was, in fact, a “miracle”. Today, the police have only one question: “A miracle for whom?”

Jamil Chade is the author of Bribes, Politics and Football – the Inside Story of the World Cup in Brazil