Foot rammed on the accelerator, Josh Quigley gripped his car’s steering wheel and braced himself for the impact.

His life was unravelling: he’d started drinking too much too young, and led a party animal lifestyle which masked the unhappiness he really felt.

Now with a relationship in tatters, he was falling apart. And in his mind, there was only one way to escape the misery.

“I hit the barrier at about 70mph and came to a complete stop,” he says in a new BBC One documentary which charts his fall and rise to record-breaking cyclist.

“There was a loud ringing noise and a lot of white smoke. I realised I wasn’t dead, I was alive.

“I had tried to kill myself and hadn’t put a scratch on my body. I thought what do I do now?”

Asked by police at the accident scene why he’d done it, he remembers answering: “I said I had a million reasons to die.”

Read more: Exhibition captures the dying days of industrial Scotland

Quigley’s remarkable journey from suicide survivor to record-breaking cyclist just six years later, is recounted in the short film, which follows him as he pushes himself to the limits in pursuit of a coveted racing spot in the forthcoming 2023 UCI Cycling World Championships.

Having proven himself as an endurance cyclist – he set a new Guinness World Record for the greatest distance cycled in a week in 2021 – his sights had been set on switching to speed.

His body, as the film reveals, had other ideas.

The Herald: Josh Quigley described how his life was unravellingJosh Quigley described how his life was unravelling (Image: BBC)

Months of training, tracking his nutrition and battling through winter weather on his bike would come to nothing as he struggled against crippling fatigue that left him at the back of the pack.

Mystified as to what was causing his energy to drain and his cycling speeds to falter, Quigley then had to struggle with the realisation that his dream to race in Glasgow alongside the world’s elite cyclists was rapidly disappearing.

The eventual diagnosis of Epstein-Barr virus solved the riddle, but its impact meant he failed to reach the standard required to take part at the highest level of his sport.

“I had been thinking it was long Covid,” says Quigley, who instead of competing in a world championship race, will be on the sidelines, offering inspirational talks at fringe events in the hope his story can help others who may find themselves in the same depths as he once was.

Read more: HMP Dumfries: Prison gardens are helping rehabilitate dangerous cons

He recalls how his bid to achieve the times he needed to take part came undone: “I had extreme tiredness and fatigue, I wasn’t recovering after being on the bike,” he says.

“On one of the last qualifying races I had to accept that things were not very good and that I needed to take some time out.

“I’ve had about five weeks off the bike and now I’m just trying to get back to training.”

The BBC One film is part of the nationwide Our Lives series, which spotlights remarkable people across the UK with inspirational and often incredible stories to tell.

In Quigley’s case, the twists and turns follow him from the depths of his suicide attempt in 2015, to pushing himself to conquer a personal challenge to cycle around the world.

It was after hearing a talk by Sir Chris Hoy at an event following his desperate bid to end his life – and, he admits, when he so unfit that cycling to the corner shop to buy milk was a struggle – he set off on two wheels for a global adventure.

Achieving it would take more than half a dozen attempts blighted by one misfortune after the next, from wrestling with homesickness to having his bicycle stolen just days into one leg of his journey and being fined for cycling through an English town centre where bikes are banned.

Amid the blips, such as the desperate need for emergency dental surgery while somewhere in Finland and the realisation that his tent was not adequate for the freezing temperatures, to a sweat-sodden ruined passport in Australia, were moments of joy as he cycled solo through stunning scenery and encountered the kindness of strangers.

The Herald: A new film reveals how Josh Quigley changed his lifeA new film reveals how Josh Quigley changed his life (Image: BBC)

But completing such an overwhelming challenge in one go was too much. The film recalls how at various points he headed home, only to drift into old ways before once again gritting his teeth and forcing himself onwards.

A particular low point that tested his resilience was the death of his beloved father to cancer in 2018.

But it also gave him the motivation he needed to keep cycling.

“Losing my dad gave me the motivation to get back on the bike,” he remembers “I’d tried to cycle around the world six times and knew I had to finish it,” he says.

He was just weeks away from his personal ‘finishing line’ in New York when he was hit by a car travelling at high speed.

He woke up in a Texas hospital with a string of injuries which he reels off in the film: “Traumatic brain injury, fractured skull, seven broken ribs, broken spine, pelvis, shin, ankle and heel bone. Three major surgeries to put me back again,” he says.

Back home in Livingston he spent hours training on an exercise bike in his conservatory, determined to return to America and complete his challenge, but with a new focus to one day become an elite cyclist potentially competing in the Tour de France.

The Herald: The start of another training day for Josh QuigleyThe start of another training day for Josh Quigley (Image: BBC)

To prove he was serious, Quigley returned from completing the final Texas to New York leg of his global challenge and set about smashing the world record for the greatest distance cycled in a week, clocking up 2,179.66 miles (3508kms) as he circled laps of an 80-mile route from Aberdeen and through the Cairngorms.

Although hopes of competing in the 2023 UCI Cycling World Championships ended as his physical health unravelled, Quigley still insists the dream of becoming a pro road racer and competing in the biggest race of all, the Tour de France, is not over.

But, now aged 30, time may be his biggest rival.

“This has been a hard year – one of the hardest,” he says. “Now I’m working towards 2024.

“I’m still trying to compete in races, to get signed by a professional team and the long term dream of the Tour de France keeps me going.

“If I’m still in the same place in 12, 24 or 36 months, I’ll probably say okay, there’s absolutely no chance. It’s already a slim chance but I still feel I’m capable of doing it. That’s the dream.

“I truly believe this is what I was born to do, this is my mission in life and that the last eight years were meant to be.”

And, he adds, whatever the future holds, he is in a better place than he once was: the overriding hope of the film, he says, is that it can inspire others who feel life has become too much.

“If you take me back to 2015 and saw me in the pub drinking and up on the table, and told me that in a few years I’d cycle around the world or take on world record attempts, I would not have believed that.

“People would be surprised at what they are really capable of.”

Our Lives: Cycling Saved My Life is on BBC One, on Friday, July 28, at 7.30pm