By Gary Duffy
BBC News, Brazil
Rio's world famous Maracana stadium was a fitting venue for the opening of the Pan American Games and, in keeping with its reputation, there was plenty of high drama.
Officials in Rio are hoping the games will be unforgettable
The ceremony to mark the occasion was an explosion of light, colour and costumes that were suitably elaborate for the city most closely identified with carnival.
There was even a 20m-long (65ft) alligator that crawled across the arena, as 4,000 entertainers pulled out all the stops backed by a wide range of Brazilian music.
There were 1,500 percussionists and even an orchestra on hand to mark the occasion.
But there were uncomfortable moments as well for some key participants.
The US representatives were booed as they arrived in the stadium.
Whether this was because of an ill-judged joke by a member of their delegation earlier in the week, or a wider feeling of anti-Americanism, was not clear.
But, even more striking, were the boos for Brazil's President Luiz Inacio Lula da Silva, and he appeared not to play as much of a role in the ceremony as had been expected.
The president was introduced at one point, but did not in fact speak, a confusion that seemed to only add to the embarrassment of the moment.
The president had been due to say "Good luck Brazil", but the phrase was uttered by the head of the Brazilian Olympic Committee instead, Brazil's TV Globo reported.
It may not have been the thanks the president was expecting for so enthusiastically backing the games.
If all goes to plan, the start of the Pan American Games in Rio de Janeiro should be another sporting moment for the country to celebrate.
This is the first major tournament held in Brazil since the World Cup of 1950.
Brazil lost 2-1 in the final in Maracana to underdogs Uruguay, in a match that is remembered by Brazilians as their worst moment of sporting anguish.
The authorities in Rio are hoping this sporting tournament will be unforgettable for all the right reasons.
It will be a major showcase for the country at a time when it is bidding to host the 2014 World Cup and the Olympics in 2016.
Rio will be hosting 5,500 athletes from 42 countries, as well as thousands of delegation members, journalists and volunteers and, it is hoped, hundreds of thousands of tourists.
A huge sum has already been spent - up to $2bn (£0.98bn) - a much larger amount than the original projection - but even so there reports of work being finished at the last moment.
And the event itself is undoubtedly taking place at a difficult time for the city.
The police have been involved in a high-profile operation to target drug gangs in a group of favelas or shanty towns, known as the German complex.
In one day alone 19 people were killed.
The police said those who died had links to crime, but this is disputed by local people.
It has raised wider security concerns for the games but these are played down by the authorities.
"Rio de Janeiro is very secure for these games," State Security Secretary Jose Mariano Beltrame told the BBC News website.
"I am certain this international event will go ahead peacefully."
"I think it will enhance the position of Brazil and improve our chances of staging the Olympic Games, the World Cup and other international events. You can come to Rio with peace of mind."
To ensure that everything does go to plan up to 20,000 police officers and special forces will be on duty.
Some analysts have connected the aggressive police actions in the German complex to a determination in Rio to ensure the games take place without incident, but the authorities have denied any link.
At a demonstration outside the mayor's office in Rio there was a different perspective on the Pan American Games.
Protesters complained that huge sums had been wasted at a time when there is enormous inequality in the country.
These concerns were shared by commentator Joao Palomino of Sports Channel ESPN.
"We can't receive the Pan American Games in Rio de Janeiro, and look out from Maracana and see the poor people. They need the money that we spend on the Pan American games," he said.
In the Maracana, for one night at least, many of these concerns were put to one side, as the crowd rallied behind Brazil's athletes.
In a country where sport is a passion, support for the home team is common ground.