The Olympic torch wound its way around Rio de Janeiro's landmarks on Friday as protesters unleashed a final blast of anger before the opening ceremony of the trouble-plagued sporting spectacle.
The carnival capital of the world is hoping the extravaganza at the Maracana Stadium will draw a line under a turbulent seven-year build-up dogged by recession, rising crime and doping scandals.
The torch was taken to the Christ the Redeemer statue overlooking Rio and other landmarks as it moved slowly toward the Maracana where the opening ceremony starts at 2300 GMT.
But as the clock ticked down to the start of the first South American Olympics in history, thousands of demonstrators took to the streets to vent their fury at Brazil's rulers and the multi-billion-dollar cost of the Games.
Waving signs reading "No to the Olympics!", about 3,000 gathered outside the luxury Copacabana Palace Hotel where many Olympic athletes are staying.
Brazil has spent more than $10 billion on new infrastructure and preparing for the Games at a time of economic crisis.
The billions lavished on the Games has angered many Brazilians as the country grapples with a tanking economy and a grim litany of social problems.
Further protests were expected around the 78,600-seat Maracana before it hosts a parade of athletes from 207 teams -- Kosovo and South Sudan are present for the first time -- and dozens of world leaders.
The ceremony launches 16 days of sporting drama featuring about 10,500 competitors, including sprint king Usain Bolt and swimming superstar Michael Phelps which wraps up on August 21.
"I hope the opening ceremony can be a kind of anti-depressant for Brazil," said one of the show's creative directors, the acclaimed "City of God" film-maker Fernando Meirelles.
"Athens was classical, Beijing was grandiose, London was smart - ours is going to be cool," Meirelles added.
- Crisis-ridden build-up -
The party will kick-off after the most crisis-ridden build-up to an Olympics in history, with a biting recession, double-digit unemployment, soaring crime and a public health crisis caused by the Zika virus just a few of the problems ravaging the city.
A political crisis led to the impeachment of President Dilma Rousseff, meaning the Brazilian leader will miss Friday's ceremony.
Signup to our newsletter and follow us on Facebook and Twitter!
Interim president Michel Temer will take Rousseff's place, but could face a hostile reception from the crowd.
Brazilian media reports say that music will be turned up as soon as he finishes speaking to mask any booing from protesters.
At most Games the lighting of the flame is a highlight.
And the secret of the Rio flame returned ahead of the ceremony when Brazilian football great Pele, 75, said he could not carry the torch because of poor health.
A vast security blanket of 85,000 military and police -- twice the number on duty at the 2012 London Games -- will be draped over the city to ward off the threat of street crime and terror attacks.
That has not been able to offer total protection, with a spate of thefts from the Olympic Athletes village. The Danish, Chinese and Australian delegations have all reported items stolen. Journalists' cameras and laptops have also been targeted for thefts.
- Drug scandal -
Anticipation for the sporting battles has been eclipsed by fallout from the Russian doping scandal that has divided the International Olympic Committee (IOC) and the World Anti-Doping Agency.
The IOC's decision not to impose a blanket ban on Russia following revelations of a state-sponsored doping program opened the door to legal turmoil that left the precise make-up of the Russian team in limbo.
On Thursday, the IOC confirmed the Russian team would be made up of 271 athletes, with 118 eliminated because of the drug scandal.
Russian Olympic Committee president Alexander Zhukov said the team was "probably the cleanest in Rio" because of all the tests and checks they have undergone.
The first gold medal should be awarded on Saturday in shooting.
All eyes will be on American swimming star Phelps, the most decorated Olympian in history, when he returns to the pool in the first week.
Track and field will see Jamaican star Bolt aim to defend his 100m, 200m and 4x100m crowns by clinching all three for the third straight Games.
Gymnastics, meanwhile, could see the world find a new darling with America's teenage star Simone Biles while new sports making their debut in Rio will include seven-a-side rugby and golf.