The Rio Olympics opening ceremony started with fireworks and laser lit choreography on Friday as Brazil sought to forget seven years of troubled preparations and the Olympic movement to temporarily put aside its doping crisis.
Under the gaze of Rio's Christ the Redeemer statue, 78,000 packed packed into the iconic Maracana Stadium to watch a four-hour party with Michael Phelps and other sporting superstars taking centre stage in South America's first Olympics.
Brazilian singer Paulinho da Viola sang the national anthem with children to set off the show of laser lights and elaborate dances before the athletes' parade.
France's President Francois Hollande and Argentina's Mauricio Macri were among a handful of state leaders in the VIP box with Brazil's troubled interim leader Michel Temer.
Organisers said the opening ceremony aimed to send a message of tolerance and respect. But it came as Brazil battles a crippling recession, double-digit unemployment and rising crime and Temer fought off political turmoil.
As the clock ticked down to the start of the ceremony, 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 people 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 mass social problems.
"This party wasn't done for the people. The Games don't come close to the reality lived by the poor. So I'm protesting against the lack of finances for our schools and for the way our salaries are only paid in instalments," said teacher Guilherme Moreira Dias, 38.
The ceremony launches 17 days of sporting drama led by a cast of elite athletes including sprint king Usain Bolt and swimming superstar Phelps which wraps up on August 21.
As well as the economic problems, Brazil is also in the grip of a political crisis which led to the impeachment of President Dilma Rousseff. She refused to attend the ceremony, leaving Temer in her place with a hostile reception from the crowd predicted.
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.
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 over 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.
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.