A groan went out in the old city of Istanbul where hundreds of hopeful Turks heard the announcement Saturday that Tokyo had been chosen to host the 2020 Olympics.

Istanbul's failed bid was a blow to Turkish Prime Minister Recep Tayyip Erdogan, who had flown to Buenos Aires to make the case straight from the Group of 20 summit in St. Petersburg, Russia.

Turkey, an early favourite, seemed to falter in June when the government clashed violently with protesters. Istanbul's bid may also have been hurt by a string of doping scandals among Turkish athletes and the uncertainty of neighbouring Syria's civil war.

Rafet Pacali, an Istanbul resident, said the repeated rejection for Istanbul in its fifth bid was difficult to take.

"They just don't want to give it to us," he said, while sparing some optimism. "Next time hopefully, if it's meant to be."

The city was prepared to celebrate where large TV screens were put up in front of the sixth-century former church of Haghia Sophia. Music blared and red and white Turkish flags waved. The crowd was ecstatic when just over an hour before the final announcement they watched the International Olympic Committee declare that Istanbul had beaten out Madrid to reach a final round of voting against Tokyo.

But when the final announcement was made after 11 p.m. in Istanbul, a brief sound of disappointment gave way to silence and the crowd quickly dissipated. Tokyo had defeated Istanbul 60-36 in the final round of secret voting.

Erdogan had argued that a successful Olympic bid for Istanbul would make it a first for a predominantly Muslim country in a city linking the continents of Europe and Asia. After the vote, he expressed disappointment.

"It wasn't our fate," he said, according to Turkish news reports.

The disappointment comes at a politically sensitive time for Erdogan as he faces a series of elections. The Turkish economy is looking increasing shaky after a decade of growth and the protests have polarized the country. The Olympic bid had already become a political issue well before the disappointment.

Turkey's minister in charge of ties with the European Union, Egemen Bagis, caused a storm last month when he suggested that anti-government protesters would be to blame if Istanbul lost the bid — a charge the country's main opposition party said was an attempt to "camouflage" any possible failure.

Madrid hopes dashed for 4th time

Tens of thousands of Spaniards were devastated after Madrid lost its bid to host the 2020 Olympics on Saturday amid fears about the country's economy and unemployment rate.

It was the third straight time the capital failed in attempts to win the Summer Games. The International Olympic Committee meeting in Buenos Aires eliminated the city in the first round of voting, with Tokyo beating Istanbul in the final round.

"What a blow," Carlos Vinuesa, a 36-year-old owner of a food transport company, said. "It's doubly disappointing because we lost both the bid and the party that Madrid had prepared. We had come with my family of three children, and frankly, this is a disaster."

Once considered a long shot because of Spain's deep financial crisis, Madrid's bid gained momentum in the run-up to the IOC's vote by arguing the games would stimulate economic growth.

But the crowd watching on large TV screens at Madrid's Puerta de Alcala square was dejected when the news was announced at 9 p.m. (1900 GMT, 3 p.m. EDT), just when the streets of the city, known for its late dinners and even later nightlife, began to fill with nocturnal revelers.

The timing helped swell the large crowd already in place next to Retiro park, where Madrid had planned to hold beach volley matches during the Games.

But as a dark cloud appeared in time to dampen the spirits of the crowd with a rain shower, the party-like atmosphere was thoroughly ruined when IOC President Jacques Rogge announced that Madrid had been eliminated after a run-off vote with Istanbul following their tie in the first round.

A deathly hush descended on the crowd and the music came to a halt. The presenters on the stage thanked the crowd for coming and bade everyone good night. People immediately fell silent and started drifting away.

"I am in shock," said 42-year-old Marta Castro, a housewife with three children. "I thought that it was a tiebreaker to see which city won and it turns out that it was to see which lost, and Madrid went out first. How sad! I hadn't imagined it."

Spanish city devastated by another Olympic failure

Madrid has now lost in its bids to host the Summer Games in 1972, 2012, 2016 and 2020.

Madrid was aspiring to become the second Spanish city to hold the Olympics. Barcelona was able to transform itself from a postindustrial town into one of Europe's biggest tourist destinations through the interest generated by the 1992 Summer Games.

The Madrid bid had linked the economic recovery of the capital and the rest of the struggling country suffering from a double-dip recession and 27 per cent unemployment to winning the right to hold the Games, saying it would attract much-needed investment.

Many Spaniards hoped the chance to host the world's biggest sporting event would have created jobs after the economy had been in recession for most of the past four years.

But Madrid's "responsible," thrifty bid based on having 80 per cent of its venues already built wasn't enough to convince the IOC members.

"It's unbelievable that we went out first," 67-year-old retiree Javier Escudero said. "And to think that we had almost everything ready with 80 per cent built? And that they said Barcelona organized the best Olympics ever? They didn't pay any attention to us. We're nothing. There it's only politics that matter and we aren't good at that. It's a shame and a pity."

The economy wasn't the only problem. Questions over its shaky anti-doping record hurt its past bids, and even a new anti-doping law passed recently apparently didn't assuage all the lingering concerns.

"The initial shock at the decision is fading, and we can take away the commitment and the union that we all showed here. If that wasn't compensated, well, that was never in our hands," said basketball player Pau Gasol, who formed a part of Spain's delegation and helped give its final presentation earlier Saturday. "The IOC voted according to its criteria. It's too bad because I think we deserved to at least reach the final."