Joy turned to despair for the people of Madrid on Friday as the city unexpectedly reached the final round of the 2016 Olympics race, only to lose for the second time in four years.
"It's unfair, we deserved it, we had everything and Rio had nothing," said Beatriz, 18, one of thousands of 'Madrilenos' of all ages gathered in the Plaza de Oriente near the royal palace to watch the results broadcast from Copenhagen on giant video screens.
The crowd had cheered, danced, hugged each other and waved Spanish flags when odds-on favourite Chicago went out in the first round, and then when Tokyo was eliminated in the second.
But the mood quickly turned glum when International Olympic Committee chief Jacques Rogge announced Rio de Janeiro as the host of the 2016 Games.
"It was a great disappointment, I was hoping it would be Madrid, it deserved it, it's not fair," said Gianni Gabati, a 56-year-old Italian resident of the Spanish capital. "Madrid is much better prepared."
"I was expecting us to win, I was sure," said Olga Gonzalez, 44, who came to the plaza with her husband and two children.
Madrid Mayor Alberto Ruiz Gallardon congratulated Rio, "which presented a great campaign. They are just winners, they had a good presentation and the IOC for the first time chose to give the Games to South America.
"It was definitely a tough task, but Madrid is greater for taking part," he told Spanish public radio from Copenhagen.
The chief of the Madrid-2016 campaign, Mercedes Coghen, said she had feared going up against Rio in the final round.
"They had the chance to stage the first Games in South America, an argument against which we have fought. The IOC decided that now was the time."
Spanish Prime Minister Jose Luis Rodriguez Zapatero, also in Copenhagen with a high-profile delegation, said Madrid "did things well, we were almost there, but finally Rio won."
It was the second time in four years that Madrid had failed to win the Olympics, after losing out to London in its bid for the 2012 Games.
The Spanish capital was an outsider to get the nod on Friday, given the unspoken rule that the host cities are rotated between continents.
But the government and city authorities had always remained hopeful.
Popular support for the bid throughout Spain was higher than for any of the other candidate cities, and 77 per cent of its Olympic facilities are already built or under construction.
The depth of enthusiasm was demonstrated at the weekend when some 400,000 people turned out in a city square to form a massive human mosaic in the colours of Madrid's candidature.
Spaniards have a passion for sports that has been boosted by spectacular recent success in football, tennis and cycling.
In the Plaza de Oriente, pop bands and street performers entertained the crowd throughout the afternoon Friday in a fiesta atmosphere in warm sunshine.
People were also invited to leave their handprints on a giant canvas in the square to show their support for Madrid's bid, the logo of which is an open palm in five colours.
A giant mosaic composed of 2,016 Rubik's Cube's also formed the Madrid logo in a park by the square.