Prince Harry’s friend was so motivated to make it to the royal wedding that he made it his mission to complete his cycling challenge across South and North America faster than planned.

Dean Stott not only finished just in time to see Harry and Meghan Markle walk down the aisle — he also beat the Guinness World Record by 18 days.

Stott, who met Harry when they were partnered during military training as U.K. special forces soldiers, began his journey cycling the Pan-American Highway from Argentina to Alaska on Feb. 1, before he received an invitation to the royal wedding.

The amateur cyclist made it his goal to complete the 13,670-mile journey in 110 days, beating the previous record by seven days.

Halfway through his journey, Stott’s wife told them they were invited to the royal wedding on May 19 at St. George’s Chapel in Windsor Castle. Stott, eager to make it to the royal wedding, decided to cut out even more time from his finish goal.

“That was my new motivation,” he told The Telegraph after he finished in Prudhoe Bay, Alaska. “I surprised myself really. It’s a bit surreal still.”

Stott admitted the challenge was “one of the hardest things” he’s ever done.

"After over two years of training I’m delighted to have not only finished but broken the Guinness World Record,” he said. “There were definitely moments where I thought I couldn’t finish but the support has helped me make it to the finish line.”

He completed his journey from Ushuaia, Argentina, to Prudhoe Bay, Alaska, in 99 days, 12 hours and 56 minutes, the Telegraph reported.

Stott took up cycling after suffering an injury that affected his running ability. He talked to Harry, who inspired him to do the Pan-American Highway challenge. Stott also began the challenge in an effort to raise more than £1 million ($1.36 million) for charities focused on mental health.

“Thanks to people like Prince Harry and the Heads Together charity partners, mental health is being spoken about much more and I hope by doing this, I have been able to inspire even more people to speak out and get the help they need,” Stott said.

The new world record holder said he is excited to see his wife and two children. He also joked his wife would have divorced him if they had missing the royal wedding.