Residents of the German city of Hamburg have voted against hosting the 2024 Olympic and Paralympic Games.
Hamburg was one of five cities left in the running, alongside Rome, Paris, Budapest and Los Angeles.
But 51.6% of residents of the city voted no in a referendum on Sunday. The No camp argued that money earmarked for the Olympics could be better spent.
German Olympics officials had picked Hamburg as their preferred candidate city ahead of Berlin.
Germany has not hosted the Games since 1972 in Munich. Voters there turned down the chance to host the 2022 Winter Olympics two years ago.
Almost two-thirds of voters in nearby Kiel, where sailing events would have been held, backed the Olympic proposal in Sunday's referendum. But turnout in the relatively small city of Kiel was under 32%, while 651,000 voters in Hamburg took part - half of the electorate.
Hamburg's mayor Olaf Scholz was disappointed with the result: "That's a decision that we didn't want, but it's clear."
The remaining cities vying for the chance to stage the 2024 Games include Budapest, Paris, Los Angeles and Rome.
Critics of the Hamburg plan said it was wasteful, at a cost of €11.2bn ($11.9bn; £7.9bn).
Hamburg's city authorities had promised €1.2bn for the event, but the lion's share would have been contributed by the national government.
Florian Kasiske from the No campaign NOlympia said people could see that the money could be better spent. He saw a change in mood in Hamburg, suggesting that the vote was linked to the large numbers of migrants and refugees arriving in the city.
"It's really about city politics. Many people are just arriving in this city and have to sleep in tents - and there has to be money for that," he said.
Stefan Kretzschmar with his silver handball medal at the Athens 2004 OlympicsImage copyrightGetty Images
The result was a setback for German sport. The chairman head of the German Olympic Sports Confederation (DOSB), Michael Vesper, said it was clear that "now it'll be impossible to hold the Olympics in Germany for decades".
He believed that the recent Paris attacks as well as the migrant crisis had played a part in the no vote. And he said that the continuing corruption scandal involving Fifa and the doping row in world athletics had also been key factors.
Others feared the negative effects on German sport. Olympic handball medallist Stefan Kretzschmar tweeted that "the gateway to the Olympic (sports)world has been closed forever. This No doesn't deserve any medals".
A spokesman for the International Olympic Committee (IOC) said that "a great opportunity for the city, the country and sport in Germany is lost".
"The city also misses the investment of the IOC of about $1.7bn to the success of the Games, which compares to the €1.2bn Hamburg wanted to invest," he added.
"Now there will be a strong competition with four excellent candidate cities. With these strong competitors we all can look forward to [an] exciting Olympic Games 2024, whoever the winner will be."
In July, the city of Boston decided to withdraw from the race to be host for 2024 amid a lack of public support.
The winning city will be selected in September 2017.