GANGNEUNG, Korea, Republic Of — Skating in front of the pack in his final Olympic race, veteran Charles Hamelin gave way to Samuel Girard for the anchor stretch. And even though Girard wasn't able to hold onto first place, he was still able to capture bronze for his mentor.

Girard from Ferland-et-Boilleau, Que., Hamelin from Sainte-Julie, Que., Charle Cournoyer of Boucherville, Que., and Montreal's Pascal Dion finished third in the men's 5,000-metre short-track speedskating relay final at the Pyeongchang Winter Games on Thursday.

Hungary won gold in an Olympic record while China took silver.

Although this was Hamelin's final Winter Games, he'll lace up his skates in a few weeks at the world championships in Montreal.

"To share the last four seasons with them, with the highs and lows, the last relay season was incredible, something very pleasant and positive for the entire Canadian team," the 33-year-old said. "We wanted to learn from each other, we have been critical of others, it's what gave us this result and we can be proud of what we accomplished today."

The bronze medal for Hamelin adds to the three gold medals and a silver from previous Olympics. He finishes his career with five medals to equal Marc Gagnon and Francois-Louis Tremblay as the most decorated short-track speedskaters in Canadian history.

Hamelin had a tough Games before racing at the Gangneung Ice Arena for a final time. He was penalized in the 1,500-metre final, the 1,000 semifinal and in the preliminary round of the 500.

It was all forgotten on Thursday night.

"Finishing with a medal, it's the last souvenir that you're going to have. It will be really nice to return home with a medal won with the guys," Hamelin said. "We're going to celebrate tonight, tomorrow and the day after, right until we return to Montreal."

In the relay final, the Canadians were stuck at the back of the pack until the South Koreans, who finished fourth, fell with 23 laps to go and the Canadians took the lead with 18 laps left.

They tried to hold off Hungary and China, but weren't able to with two laps to go.

"The reason for the South Koreans' fall earlier, their exchange was off-beat from ours," Girard, 21, said. "The Koreans cut on the inside to make the exchange while I was taking my exchange with Charles. There was some pretty hard contact right there. I lost my speed and I tried to take the relay the best I could to block and Charles tried to give me as much speed as possible.

"It was difficult circumstances."

Girard had to deal with a broken skate blade earlier in the night during the 500 metre semifinal. After some quick repairs, he moved onto the final where he finished fourth. He won gold in the 1,000 earlier in the Games.

Winning the bronze with Hamelin was a special moment for Girard.

"To experience that with Charles in his final Games, his last race, even more, he was searching for his fifth medal, it's a moment that we'll remember our entire lives," Girard said. "For us, it was our first Games, for him it was his last. Yes, it's a bit like passing the torch. These are some great moments but we're not done living these great moments."