Runner Matthew Rees was moments from finishing the London Marathon on Saturday when he stopped to help an exhausted competitor.

Rees told the Press Association that he was on the final stretch of the race when he noticed runner David Wyeth having difficulties.

“I saw him try to stand up again and his legs just went down again, and I thought, ‘This is more important, getting him across the line is more important than shaving a few seconds off my time,’” Rees said.

So Rees ran over to Wyeth, allowed the fatigued athlete to lean on his shoulder and helped him continue the race.

Within a few moments, a race official threw Wyeth’s other arm over his shoulder and together, the trio slowly jogged over the finish line to great applause.

Prince William, Prince Harry and Duchess Kate were among the throngs at the finish line, cheering them on.

Rees’ sportsmanlike maneuver quickly made headlines around the world. The London Marathon’s official social media accounts even praised the athlete for showing what the competition was all about.

Matthew Rees, of @SwanHarrierDev, you've just encompassed everything that's so special about the #LondonMarathon. We salute you. 👏👏 pic.twitter.com/86Ql4LLBEa — London Marathon (@LondonMarathon) April 23, 2017

Thank you all for the overwhelming support! @thewelshrunner is an inspiration!It's been a wonderful day for the club pic.twitter.com/OXl2iLTxmk — Swansea Harriers (@SwanHarrierDev) April 23, 2017

Thank you @SwanHarrierDev for helping our runner cross the line. Xx — The Chorlton Runner (@chorltonrunners) April 23, 2017

A total of 39,487 runners crossed the finish line last weekend, making the event the biggest London Marathon in history.