TORONTO -- A Spanish athlete is drawing praise online after he gave up his win in the 2020 Santander Triathlon to his competitor who took a wrong turn towards the end of the race.

Diego Mentrida allowed Britain's James Teagle to finish ahead of him despite Teagle making a wrong turn less than 100 metres from the finish line.

Mentrida had been behind Teagle for the duration of the race but overtook him after Teagle mistakenly ran towards spectators in a fenced area.

The 21-year-old noticed his opponent's mistake, slowed his pace and eventually stopped to allow Teagle to cross the finish line before him and claim third place.

Speaking after the race, Mentrida told Eurosport that his rival "deserved" a place on the podium as he was ahead for most of the race.

"When I saw that he had missed the route, I just stopped. James deserved this medal. He didn’t notice the signs or they were misaligned. I don't know, but the second time I would have acted the same," Mentrida said.

The race took place on Sept. 13 in Barcelona but video footage of the kind act has spread on social media in recent days with users commending Mentrida for his show of sportsmanship.

The race winner Javier Gomez Noya described Mentrida's gesture as "the best in history" while Liverpool goalkeeper Adrian San Miguel said on Twitter that it demonstrated "the real values of sport."

Teagle also took to social media to comment on Mentrida’s gesture, saying sportsmanship is a "highly regarded trait."

"I crashed into the barrier and thought it was over. @diegomentrida then did the unexpected… Having seen what happened he stopped and allowed me to pass showing incredible sportsmanship and integrity!" Teagle wrote.

Race organizers awarded Mentidra an honorary third place on Friday and gave him the same 300 euro ($469) prize winnings as Teagle, according to Spanish newspaper El Mundo.

Mentrida took to Instagram on Saturday to thank those for applauding his act.

"This is something my parents and my club taught me since I was a child. In my view it should be a normal thing to do," Mentrida wrote.