Harry's friend in race against time to make it to royal wedding

The royal wedding on AOL UK: Latest news, pictures and video

A friend of Prince Harry has ensured he will be home in time for the royal wedding - by completing a two-continent cycling challenge at record speed.

Dean Stott, 41, travelled the 14,000-mile Pan American Highway in 99 days, 12 hours and 56 minutes, knocking an astonishing 17 days off the previous best.

He finished the epic feat, which took him from the tip of Argentina to Alaska, early on Saturday morning, leaving barely a week to return to the UK and take up his invitation to Harry's wedding to Meghan Markle.

The former special forces soldier trained with the prince for six weeks in 2007 and the pair have stayed close, with the groom-to-be finding time this weekend to congratulate his guest on the record-breaking achievement.

Dean Stott smashed two world records on his journey (PA)
Dean Stott smashed two world records on his journey (PA)

Mr Stott learned he was invited to the Windsor ceremony half-way through the trip, forcing him to abandon his rest days so he could make it back in time.

His heroics have raised nearly £500,000 for the charity partners of Heads Together, a mental health campaign championed by Harry and his brother, the Duke of Cambridge.

His journey ended in Alaska (PA)
His journey ended in Alaska (PA)

Speaking from Alaska on Sunday evening, Mr Stott told the Press Association: "When I originally set out on the campaign the world record was 117 days and five hours, my aim was to do it in 110 days.

"I did the South America phase and took 10 days off that world record, so I knew I was in a good position.

"Then the day after I got into America, my wife rang me to tell me we were being invited to the royal wedding.

"If I originally went for 110 days it would have been on day 107, so I literally had to give up my rest days and start pushing out some big miles - that was another incentive.

"I was quite comfortable knowing I had broken the world record, but it was just like 'right, now you need to get to the wedding'."

A knee injury forced Dean out of the army (PA)
A knee injury forced Dean out of the army (PA)

The former military man left the armed forces after suffering a knee injury from a parachuting accident.

As he attempted to adapt to everyday life, his mental well-being began to deteriorate - until he found exercise could help restore an even keel.

In a tragic twist reflecting the scale of the problem among veterans, three of his comrades took their own lives while he was undertaking the challenge.

Mr Stott and Harry worked together on the fundraising drive to help draw attention to the issue, while also highlighting how an active life can be beneficial to mental health.

Prince Harry and Dean Stott worked together on the fundraising campaign (PA)
Prince Harry and Dean Stott worked together on the fundraising campaign (PA)

They hope to raise £1 million once an auction is held for the intrepid troop's cycling gear at a ball in the summer.

"For me, when I had my injury, I was in quite a dark place, I was snappy and moody, but when I then got into cycling I found an activity and the link that physical activity helps your mental state," Mr Stott said.

"Myself and Harry do stuff with other military charities, so when I told him about what I was doing, this was in April 2016 when Heads Together was in its infancy, he said would I mind doing it for this campaign and I said 'no, it's the perfect fit'."

He added: "Him and I have been messaging along the way, I've been informing him whenever I'm in a new country so he's been informed of my progress and obviously I messaged him yesterday with the final photos and he was over the moon."

The journey required an average of 10 hours a day in the saddle - which reached 17 hours for the final stretch - across 13 countries.

The pair trained together for six weeks (PA)
The pair trained together for six weeks (PA)

By the time Mr Stott had crossed the finishing line in Prudhoe Bay, Alaska, he had been chased by dogs in South America, had bison gallop at his side in North America and even seen a polar bear.

He also survived several collisions with cars and multiple bouts of food poisoning.

"If you looked at the 14,000 miles you would be consumed by it - the enormity of the challenge, the distance," he said.

"I broke it down to bite-size, a country at a time, a day at a time, even during the day I broke it into four phases and before you know it you've ticked off one country, you've ticked off two and you're starting to make some good progress."

But, between now and his friend's wedding next Saturday, Mr Stott has another major challenge - finding a suit that will fit his drastically slimmer frame.

"We land on Thursday in time for the wedding - I won't even have a chance to go home to Aberdeen - I'll have to get my morning suit tailored because I've lost about 10 kilos," he said.

Donations can still be made to Mr Stott's cause at www.pah18.com