Zlatan Ibrahimovic's international career ended in disappointment as Sweden exited Euro 2016 following a 1-0 defeat to Belgium in Nice.
The captain revealed ahead of the game that he would be retiring from Sweden duty when they went out of the tournament, a fate that was sealed by Radja Nainggolan's impressive strike six minutes from time.
Ibrahimovic and Romelu Lukaku both had goals ruled out in the second half of a match that only caught fire in the closing stages, with Sweden paying the price for their failure to break down Marc Wilmots' men.
Belgium put in a subdued performance, but the late victory ensures they finish second in Group E and progress to face Hungary in the last 16.
Sweden, meanwhile, conclude the group stage with one point from three games - a total that puts them bottom of the standings.
Thibaut Courtois made a big early save from Marcus Berg - Sweden's only change - after Belgium had failed to deal with a free-kick from the left.
That was Sweden's first shot on target in the tournament, but Belgium were next to threaten when Kevin De Bruyne's long-range effort tested Andreas Isaksson after good work from Eden Hazard to create the chance.
Ibrahimovic was just off-target with an effort for Erik Hamren's men, before Thomas Meunier's glancing header from De Bruyne's delivery flew inches wide at the other end.
Berg's control let him down at the crucial moment when Ibrahimovic played him in after the break, while the captain had an acrobatic goal ruled out after the referee had blown for a high foot from his strike partner in the build-up.
That was Berg's last act with John Guidetti sent on as Sweden searched for the winner they needed, but Isaksson had to get down sharply to push away a De Bruyne effort and keep his side in with a chance.
Isaksson made another key block after Lukaku bore down on goal, before the Everton attacker raged against an offside flag having put the ball in the net from Meunier's pass a few moments later.
Ibrahimovic almost got a goal that would have extended his Sweden career, but Courtois pushed away his long-range free-kick
Sweden came even closer in the final stages, with Andreas Granqvist's header from Kim Kallstrom's cross dramatically cleared off the goal-line by De Bruyne.
But their hopes of qualification were ended when Hazard made ground down the left and his cross found Nainggolan, with the Roma midfielder taking one touch before rifling a great strike into the far corner from 20 yards with the aid of a slight deflection.
De Bruyne and substitute Christian Benteke both came close to adding gloss to the scoreline for Belgium as Sweden desperately searched for a way back into the game, but one goal proved to be enough for victory.