The Rio 2016 OIympics get underway this evening in the midst of a bitter national political crisis, a deep economic recession, and a cascade of bad press that has already branded them a disaster. Yet, somehow, there remains a sense that the Games could still provide a feel-good boost to a troubled country.
"It's possible that the Olympics could become a source of optimism, if the mood in Rio improves," says Mauricio Santoro, an international relations professor at Rio de Janeiro State University. "But there are also a lot of 'what ifs'. What if there is a terrorist attack? What if there are incidents of violent crime, like shootings?"
This kind of talk would have been easily brushed aside back in 2009, when the IOC awarded the Games to Rio at a time when Brazil's economy was booming and its confidence on the global stage was soaring — not any more.
"When Rio was chosen no one could have predicted how the situation was going to change so much in seven years. People were celebrating back then," adds Santoro. "But in the last few years the mood has changed, and now people are unhappy. I didn't expect this level of anger."
Much of that anger, and the pessimism, is linked to the national political turmoil.
The Olympics are taking place at the same time as the push to impeach suspended president Dilma Rousseff, over her alleged manipulation of national accounts, enters the home stretch. The senate is expected to vote on whether to dismiss her permanently at the end of the month.
The impeachment crisis has created a bitter divide in Brazil, with supporters of Rousseff and the governing Worker's Party describing the process as a coup and calling for demonstrations during the Olympics, beginning today.
Rousseff's stand-in, Michel Temer, is also suffering dismal approval ratings, and can perhaps expect to be booed in the opening ceremony.
'When Rio was chosen no one could have predicted how the situation was going to change'
And it is all taking place against a backdrop of the vast corruption network uncovered at the state-run oil company Petrobras, that has implicated dozens of politicians and business leaders and deeply shaken the already fragile confidence ordinary people had in the elite.
At the same time, Rio's Ollympics have also become directly embroiled in the collapse of the Brazilian economy, which is now mired in its longest recession since the 1930s.
In June the Rio de Janeiro state government decreed an official state of emergency as the region spiraled into economic meltdown. At the time an official spokesman warned of a "total collapse of public security, health, education, mobility, and environmental management."
Students have occupied schools protesting cutbacks, while the city morgue temporarily stopped taking in new corpses after cleaning staff were fired. Hundreds of thousands of public workers have gone unpaid, and the state financial secretary has said that the local government expects to post a $5.6 billion deficit in 2016.
There have also been worries about the hurried improvements to the city's transport infrastructure. The metro extension to and from the Olympic Park in the western suburb of Barra de Tijuca opened just days before the event, and will function only for those working at, competing in, or watching the Games.
The recent controversy surrounding the shoddy condition of the athletes' accommodation at the Olympic Village spiralled when the Australian delegation initially refused to move in. The flippant response of Rio mayor Eduardo Paes, who said that he'd even tried to bring a kangaroo to the Village to make the Australians feel at home, made matters worse.
Even before the current financial crisis, Rio de Janeiro has long been troubled by massive social problems — the inequality famously visible in the contrast between shabby favela housing and gleaming beachside apartment blocks. The publication of stories around the world about the forced evictions of around 77,000 local residents to make way for Olympic building projects didn't help the image.
Security has also been a growing concern, both because of the fear of a terrorist attack and rampant local petty crime that can often have fatal consequences.
'Just when we thought the levels of police brutality could not get any more shocking they do. Brazil has lost the Olympics even before they started'
Recent figures showed that there are 16 murders a day in the state, many the result of a vicious and long-running war between police and drug trafficking gangs. And it can often seem as though the local police add to the region's culture of urban violence, rather than helping to pacify it.
A 2015 Amnesty International report said that Rio cops had been responsible for 1,500 murders over the previous five years — 16 percent of the total number of homicides in the city over the same period.
According to recent figures from the Institute of Public Security, killings by police increased in the run up to the Games, with 40 homicides in May, a leap of 135 percent from the death total in the same month last year.
"Just when we thought the levels of police brutality could not get any more shocking, they do. Brazil has lost the Olympics even before they started," Atila Roque, director of Amnesty International Brazil, said in a statement released this week. "The seemingly unstoppable rise in killings by the police has put any chance of a positive Olympic legacy in the area of public security in serious doubt."
The controversy over security has even invaded the opening ceremony thanks to the uproar triggered by reports that it was going to includes a skit in which supermodel Gisele Bündchen was assaulted by a kid from the favelas.
The ceremony's director — Fernando Meirelles, the famed creator of the acclaimed Rio favela movie City of God — vigorously denied it. He said he had merely experimented with a joke in which a street vendor approached Bündchen for a selfie and was chased off by security guards. The rest, he said, was a "tremendous misunderstanding."
But what uplifting message can tonight's ceremony give?
The Rio2016 website's blurb says it will "deliver a message for planet earth" symbolized by each athlete being given a seedling to plant.
This will do little to help Rio meet its promise to plant 24 million seedlings to compensate for the carbon emissions caused by the Games. With days to go, it had planted 5.5 million.
But the highest profile failure to live up to the pledge to make Rio's Olympics a Green Games for a Blue Planet lies in the risk to athletes and visitors posed by the water in the Baia de Guanabara that remains heavily polluted despite a pledge to treat the sewage that flows into it. The promise had been to raise the percentage treated from 15 to 80 percent. The authorities now claim to have reached 50, but many don't believe them.
"The Games have become a symbol of the waste of resources and the incompetence of the politicians," says Santoro, the political scientist. "Lots of the problems we are seeing in Rio right now are making people frustrated and angry."
Some of the tension boiled over when the Olympic torch arrived in Rio this week from an already accident-prone trip around the country. On Wednesday riot-gear clad cops in the working class town of Duque de Caxias on the outskirts of Rio used tear gas and plastic bullets to disperse crowds as a teachers' demonstration approached the torch relay.
But now that the moment of truth has really arrived, organizers must now be crossing their fingers that the disasters can be held at bay as the spotlight turns to the sporting brilliance, the coming together of fans and athletes from around the world, and Rio's reputation as a vibrant, party-loving city.
'There's always a feel-good moment. Sports are always beautiful to see'
Some point to the way massive pre-World Cup street protests against corruption and austerity in 2013 died away once the soccer started. That tournament ended up judged a success.
"Some Olympics have had their difficulties, perhaps all of them have, but none have had as many as what has happened in Rio de Janeiro," Carlos Nuzman, the president of the organising committee, said in an interview with local media a few weeks ago. "[The problems] have provided more motivation to struggle and demonstrate the Brazilian spirit, and the way it is possible to overcome the challenges and the the difficulties to ensure spectacular Games."
Juliana Barbassa, author of a book about the Rio and the Olympics called Dancing with the Devil in the City of God, is not easy to convince.
"The Olympics were a terrible idea, built on a false promise to the population, which was that they would make Rio a more just, equitable city," she says. "Brazil has gone through a cycle of mega-events now, and people are questioning their elected officials and the spending of their tax money. This is something that has not happened so overtly here before. But we're learning the lesson in a very expensive way."
But even Barbassa is not ready to dismiss the potential of the Olympics to turn the tables.
"There's always a feel-good moment," she says. "Sports are always beautiful to see."
(Elian Peltier contributed to this report)
Follow James Armour Young on Twitter: @seeadarkness