RIO DE JANEIRO -- With fireworks forming the word "Rio" in the sky and supermodel Gisele Bundchen shimmering to the tune of "The Girl from Ipanema," Rio de Janiero welcomed the world to the first Olympic Games in South America with a serious message underlying the celebration: Let's take care of our planet.
After one of the roughest-ever rides from vote to games by an Olympic host, the city of beaches, carnival, grinding poverty and sun-kissed wealth opened the two-week games of the 31st Olympiad with a high-energy gala celebration of Brazil's can-do spirit, biodiversity and melting pot history.
The low-tech, cut-price opening ceremony, a moment of levity for a nation beset by economic and political woes, featured performers as slaves, laboring with backs bent, gravity-defying climbers hanging from the ledges of buildings in Brazil's teeming megacities and - of course - dancers, all hips and wobble, grooving to thumping funk and sultry samba.
But Brazil also packaged its party with solemnity, lacing the fun and frivolous show with sobering messages about global warming. Images of carbon dioxide, a greenhouse gas, swirling in the Earth's atmosphere were followed by projections of world cities and regions - Amsterdam, Florida, Shanghai, Dubai - being swamped by rising seas. The peace symbol, tweaked into the shape of a tree, was projected onto the floor of the Maracana Stadium that filed with thousands of athletes from the 207 teams.
There were times after the International Olympic Committee selected Rio ahead of Chicago, Tokyo and Madrid in 2009 when it seemed that the city of 6.5 million people might not get its act together for the world's greatest sporting mega-event. The spreading health crisis of the mosquito-born Zika virus kept some athletes away. Promises to clean up Rio's filthy waters remained unfulfilled. The heavy bill for the games, at least $12 billion, made them unpopular with many. Heavily armed security stopped a small group of protesters from getting close to the stadium ahead of the ceremony.
Greece, the historical and spiritual home of the games, led the march by athletes into the stadium. They were being joined by a first-ever Refugee Olympic Team of 10 athletes, displaced from Syria, South Sudan, Congo and Ethiopia. Their flag-bearer, Rose Nathike Lokonyen, fled war in South Sudan and ran her first race in a refugee camp in northern Kenya.
With "USA" emblazoned on the back of his jacket, Michael Phelps carried the flag for the U.S. team, the largest with 549 competitors. At his fifth and last Olympics, it was the first time the record holder of 22 medals had marched in an opening ceremony, having skipped previous ones to save energy for competition.
While it escaped a blanket ban, Russia is paying the price in the shape of a smaller team, whittled down from a 389 athletes to around 270.
After the grandeur of Beijing's opening ceremony in 2008 and the high-tech, cheeky inventiveness of London's in 2012, Rio's was earthier and less swish but more sobering with its gloomy environmental look at the future and deliberate penny-pinching. Creative director Fernando Meirelles said their budget, slashed by half as Brazil's economic recession bit ever harder, "is 12 times less than London, 20 times less than Beijing."
"It is pretty tacky to be overspending," he said. "It is not a good message for the world. When 40 percent of the homes in Brazil have no sanitation, you can't really be spending a billion reals for a show."
Behind the protest line
While Meirelles speaks of pinching pennies, many Brazilians feel hosting the games is a waste of precious resources. A recent survey by Datafolha shows 63 percent of Brazilians think hosting is doing more harm than good; only 16 percent are enthusiastic.
There have been consistent protests in the run-up to the Olympics, much of them aimed at the Olympic torch relay as it circled the country of 200 million.
On Friday, thousands of protesters forced organizers to shift the relay away from its planned route on the famed Copacabana beach.
Many are aghast at the $12 billion Olympics price tag in the midst of Brazil's deepest recession since the 1930s. Brazil's employment is above 10 percent, and the local currency has tumbled in value against the dollar in the last year. Rio suffers from major public health issues, including notoriously polluted waters.
On Friday, protesters got within about 1.5 miles of the Maracana stadium. As they tried to get closer, security pushed them back, setting off clashes. Heavily armed security appeared to fire tear gas to keep them from reaching the site of the opening ceremony.
Television footage showed two protesters setting fire to a yellow shirt carrying the logo "Rio 2016" and worn by staff working at the Olympics.
It was not clear how many protesters were detained, though footage showed at least one young man being placed into the back of a police van.
The spector of doping
Just hours before the opening ceremony Friday, the Greek Olympic committee announced the first positive doping test of the Rio Games.
The committee says an unnamed member of the Olympic team failed a doping test in July in Athens. The Greeks say the athlete has left the Olympic Village.
Dozens of athletes have failed doping tests at the last two Olympics, most caught in recent retests of stored samples. The IOC stores doping samples for 10 years so they can be retested when new methods become available, meaning drug cheats who escaped detection at the time can be caught years later.
Zika questions still linger
With the games underway, the elephant in the room remains the Zika virus. Brazil is at the epicenter of the current Zika outbreak, with more than 100,000 cases of the mosquito-borne illness reported in that country. Concerns have been rife despite the World Health Organization (WHO) stating there is a "very low risk" of further international spread of Zika as a result of the games back in June.
Zika has already spread through most of Latin America and the Caribbean.
The virus poses a particular risk for pregnant women because it's been linked to a severe birth defect called microcephaly, where babies are born with abnormally small heads and possible brain damage.
Many athletes bailed on the Olympics out of concerns about Zika.
The Olympics of security
After years of planning, Brazil's complex Olympics security operation is now being put to the test.
Outside Maracana stadium, military vehicles, police and 35 checkpoints took over the streets on Friday, creating long lines and traffic jams.
Neither Brazil's Defense Ministry nor Rio de Janeiro police will say how many security personnel are on the ground to secure the Olympic opening ceremony. As many as 85,000 will be on site until the end of the games. That's twice as many as London four years ago.
More would have been on the ground if Rio wasn't forced to cut about $550 million from the Olympic budget amid a recession.