AL RAYYAN, Qatar (AP) -- As France searched for a late equalizer, the players on Tunisia's bench were watching another World Cup match on TV hoping for a goal.
Neither of them came, giving Tunisia a momentous 1-0 win over defending champion France that still wasn't enough to prevent the north African team from being eliminated.
Wahbi Khazri scored in the 58th minute Wednesday to lead Tunisia to only its third victory at a World Cup tournament. But in stoppage time, the Tunisians on the sidelines were more interested in the other Group D game, crowding around a TV screen on the bench hoping Denmark would be able to score against Australia -- a circumstance that would have lifted Tunisia into second place and also into the round of 16 in Qatar.
"We were praying for a Denmark goal but it never game," Khazri said. "But that's the thing with soccer, you should only count on yourself. We didn't do enough in the first two games, otherwise we'd be through."
France ended up winning the group with six points, ahead of Australia on goal difference. Tunisia finished with four points in third place. Denmark, which lost to Australia 1-0, ended up in last place with one point.
It was France's first loss at the World Cup since the 2014 quarterfinals, when Germany beat the team 1-0.
Khazri broke the deadlock early in the second half, running at the heart of the French defense and beating two players before poking the ball into the bottom corner.
He fell to his knees in celebration and was mobbed by teammates. When he got back up, he made a heart shape to the Tunisian fans behind the goal and then limped off, appearing to hurt himself as he fell when scoring his 25th international goal and his third at World Cups.
France forward Antoine Griezmann thought he had evened the score in the eighth minute of stoppage time but he was ruled offside following a video review.
A few minutes after Khazri's goal, a man ran onto the field at Education City Stadium with what appeared to be a Palestinian flag. He did some acrobatic jumps before six security officials dragged him off.
With France already qualified for the knockout stage, coach Didier Deschamps rested Griezmann, Kylian Mbappe and most of his regular starters. Only four of the team lining up at the beginning had even started a World Cup match before.
"It will be a good lesson for them. Now they know what the highest level is all about, against a Tunisia team that was supercharged," Deschamps said. "But we were too timid, late in the tackle and made technical errors."
Deschamps defended his decision further, saying his team's sizeable goal difference over Australia was enough of a safety net.
"We didn't need one point," he said. "Unless something catastrophic happened (in the other game)."
Khazri said he didn't believe France was disrespecting Tunisia by fielding such a weakened team.
"A lack of respect? No. (Aurelien) Tchouameni plays for Real Madrid and so does (Eduardo) Camavinga," Khazri said. "It's an honor to play against them. I grew up in a little corner of Corsica that nobody's ever heard of, so it's amazing for me to play at the World Cup."
Khazri's goal, however, prompted Deschamps to bring on Mbappe and Griezmann and the increased urgency almost led to an equalizer.
"I wanted to give Kylian 30 minutes, which is what I'd planned to do," Deschamps said.
Deschamps had selected more of a "C" team than a "B" team. Randal Kolo Muani struggled to make an impact at center forward and Kingsley Coman -- who scored Bayern Munich's winner in the 2020 Champions League final -- was isolated.
France central defender Raphael Varane, however, mopped up on the occasions Tunisia got close to the penalty area in the first half.
France will face Poland in the last 16. The Poles finished second in Group C behind Argentina but advanced on goal difference ahead of Mexico.
With goalkeeper Hugo Lloris among the rested, 37-year-old Steve Mandanda played only the second World Cup match of his long career. The other was also in the team's third group game four years ago.
Mandanda's appearance means Lloris will have to wait a little longer to equal defender Lilian Thuram's national record of 142 appearances. Lloris has made 141 appearances for Les Bleus.
Striker Olivier Giroud also has to be patient. He still has 51 goals, equal with Thierry Henry as France's all-time leading scorer.
Deschamps explained why he didn't select Benjamin Pavard for the match. The World Cup-winning defender started the opening game against Australia.
"I had several discussions with him," Deschamps said, "and decided he was not ready to play."