Scotland's hopes of qualifying for Euro 2016 took a huge blow as they lost 3-2 to Germany in a thrilling encounter.
Thomas Muller put the visitors in front after 18 minutes at Hampden Park on Monday night but Scotland levelled within 10 minutes through a Mats Hummels own goal, only for Muller to score his second six minutes later.
James McArthur's fine strike made it 2-2 two minutes before the break, but Ilkay Gundogan fired in a 54th-minute winner to consign Gordon Strachan's men to their second defeat in five days.
Wins for Poland and the Republic of Ireland mean the Scots cannot finish in the top two of Group D, while they sit four points behind Martin O'Neill's side in the battle for the play-off spot.
The hosts started brightly, allowing Germany plenty of possession but pressing them well and not allowing them too much time on the ball.
But that seemed to dissipate quite quickly, and the world champions were in front in the 18th minute as Muller was allowed to run forward before his low effort took a big deflection off Russell Martin and rolled into the far corner.
It was a devastating blow as Strachan's men desperately needed a result to keep up their qualification hopes, but they were level 10 minutes later as Emre Can fouled Charlie Mulgrew just outside the box.
Shaun Maloney fired in the free-kick but Manuel Neuer could only parry it forward, and the ball hit Hummels before bouncing into the back of the net.
Scotland were only level for six minutes, though, as Muller bagged his second in the 34th minute. Can latched on to a loose ball and fired a first-time effort which Marshall parried up for Muller, whose header just crossed the line before Martin could clear.
Two minutes before the break the hosts levelled once again as a half-cleared corner fell to McArthur on the edge of the box, and the Crystal Palace midfielder first a first-time effort through a crowd of players and into the net before Neuer could react.
The second half started in a similar vein to the first, with Germany enjoying most of the possession, and they nearly went back in front soon after the restart as Mario Gotze latched on to Bastian Schweinsteiger's fine cross, only to be flagged for offside as he headed into the top corner.
But it was not long before they did go in front, as on 54 minutes Muller picked the ball up on the right-hand side before pulling a low cross back for Gundogan, who fired a powerful low shot in off the upright to put Germany back in front for the third time.
Scotland goalkeeper David Marshall had to work hard to keep the hosts in the game, saving well from Schweinsteiger's powerful effort before denying Gundogan a second with a strong parry from his long-range strike.
But it would not matter as Strachan's men could not battle their way back with another equaliser, and Scotland are now unable to catch Germany or Poland, while they lie four points behind the Republic of Ireland in the battle for third place in the group.
They must now hope for maximum points against Poland and Gibraltar in their remaining fixtures, although a win and a draw would be enough to secure a play-off place if Republic of Ireland lose to both Germany and Poland in their remaining games.