LUSAIL, Qatar (AP)Kylian Mbappe scored a hat trick seemingly from out of nowhere to electrify the World Cup final, he ended the tournament as the leading scorer with eight goals, and he still missed out on winning a second straight title.

The France superstar was on the losing side of an epic final against Argentina that was settled in a penalty shootout after a 3-3 draw on Sunday. He was then consoled on the field by French President Emmanuel Macron.

”Kylian has really left his mark on this final,” France coach Didier Deschamps said.

Mbappe had been the leader France desperately needed as time was running out with the defending champions trailing 2-0 and playing poorly. The forward had also been almost invisible up to that point.

But his goals carried France back into the match – twice. First, late in regulation time. Then again deep in extra time.

Mbappe converted a penalty in the 80th minute and then scored with a volley from just inside the area in the 81st.

It took only 97 seconds for him to get France even with Argentina and the great Lionel Messi.

Mbappe scored a second penalty in extra time, about 10 minutes after Messi had given Argentina the lead again in what became a compelling duel between the two players.

Mbappe’s hat trick was only the second in a World Cup final – the other was by England striker Geoff Hurst in 1966.

The Frenchman leaves Qatar with the Golden Boot trophy as the tournament’s top scorer with eight goals. At the age of 23, he’s matched Pele’s career total of 12 World Cup goals.

But Mbappe couldn’t quite match the Brazil great’s back-to-back World Cup titles – both players were teenagers when they won their first one, Pele in 1958 and Mbappe in 2018.

One minute before Mbappe turned the game on its head, Argentina’s fans began to taunt him.

Chants of ”Ole, Ole” rained down from the stands at Lusail Stadium as Mbappe futilely chased the ball while his opponents passed it over and around him.

Mbappe gestured in frustration with his right arm at the apparent hopelessness of the situation.

But after scoring his first two goals, Mbappe surged into the Argentina half looking for a game-winning third. His darting, twisting run resulted in a shot deflected just too high.

Once he eventually got the hat trick to make it 3-3 in extra time, Mbappe set out for a fourth. His curling cross barely eluded the head of substitute Randal Kolo Muani, and a final dribble deep into the Argentina penalty area was scrambled clear as he looked to shoot.

He shouted out loud as his last attempt to win the game single-handedly slipped away.

Mbappe tried to set the tone in the penalty shootout, taking responsibility for the first kick. He converted the penalty but France still ended up losing 4-2. Messi did the same for Argentina to start the shootout, but his teammates all scored their penalties.

During the shootout, Mbappe made sure he was the first to console Kingsley Coman and Aurelien Tchouameni on their slow walks back to the center circle after their failures to score.

Mbappe stood bent over in the center circle, hands on his knees, as Argentina defender Gonzalo Montiel prepared to take the decisive kick. He then squatted, saw the net ripple and walked away alone amid the Argentina celebrations.

Deschamps eventually came over behind his player to put arms around his neck. Mbappe soon went to the team dugout and sat slumped in a chair with his dark blue shirt pulled up over his face to hide his emotions.

Long after the game was over, Mbappe left the stadium with his head bowed and the World Cup trophy securely in the hands of Messi.

AP World Cup coverage: https://apnews.com/hub/world-cup and https://twitter.com/AP-Sports