Slovakia’s Branko Radivojevic scored twice to break French hearts and claim the final quarter-final berth at the Ice Hockey World Championships on Tuesday.
France, needing to win to steal fourth spot from Slovakia, lost 5-4 in a see-saw game.
France conceded two goals in the opening seven minutes of the first period, but they fought hard to level the game 2-2.
In the remaining two periods, Slovakia edged ahead 3-2 and 4-3, with France coming back each time to level the scores.
With France forward Nicolas Besch in the sin bin for interference, Radivojevic netted the game-winning goal on the power play with 10 minutes to go in the third period.
The win gave Slovakia third place in Group H and a quarter-final meeting with Canada, who beat Belarus 5-1 to top the group, with Ryan O’Reilly scoring twice.
The US defeated Switzerland 5-2 to finish fourth and set up a quarter-final meeting with Finland.
In Stockholm, Henrik Zetterberg scored one goal and made another as co-hosts Sweden beat Latvia 4-0 in Group S. They will now face the Czech Republic in the first knockout round.
Group winners Russia, who won all seven of their games at the preliminary stage, will face fourth-placed Norway, who beat Denmark 6-4 in their final group game.
The quarter-finals take place in Stockholm and Helsinki today.