It is fully 13 years since the idea for a film of former cyclist Graeme Obree's remarkable life story was first mooted. Back then, Jonny Lee Miller, who plays Obree in the biopic, The Flying Scotsman, had yet to introduce himself to a worldwide cinema audience as heroin-fuelled Sick Boy in the film of Irvine Welsh's novel, Trainspotting.

The making of the film has since become an epic, a project which has undergone horrendous funding problems and was almost never made. It has been finished for more than two years, but was only released last weekend. The doggedness required to finally bring it to the big screen is an appropriate metaphor for the physical and mental struggles endured by Obree over the years.

Obree is the Scottish cyclist who twice broke the world hour record on a self-made bike which cost £70. He also won the 4km individual pursuit title at the World Championships in 1993 and 1995 and waged a constant battle with the Union Cycliste Internationale (UCI) over his unconventional riding positions.

His battle with alcoholism and mental illness, including two suicide attempts, are an intrinsic part of his story. The pursuit of sporting immortality was a way to conquer his demons, to try to find self-worth.

Miller's portrayal of Obree's intense, obsessive personality is well-judged. It is his best performance since Sick Boy, Welsh's peroxide junkie in Trainspotting, which hit our cinemas 11 years ago. To Miller's eternal credit, he stuck with the project through the kind of troubles that would have prompted other actors of his stature and profile to throw in the towel. On one occasion he was ready to board a plane to Scotland to shoot scenes when he was told there was no film.

Physically, he also put himself through the wringer, regularly heading out for 20-mile cycle runs and pedalling to the set every morning come rain, hail or shine.

"Jonny did a brilliant job and took to cycling like a duck to water," commented Obree. "Within days he was copying my hand movements almost subconsciously and my autobiography was never out of his hands. Jonny and I took turns at cycling in the film. I did a wee bit of body doubling - not because his legs weren't up to it, simply because the amount of cycling involved was absolutely amazing."

Miller added: "I can honestly say I've never sweated so much at work in 25 years."

Some critics have sniffily dismissed the film's handling of Obree's mental illness. "The movie's treatment of it is so perfunctory that it might have been better not to address the subject at all. Mr Obree's inner demons remain safely hidden," read the New York Times review.

The opening scene of the movie shows Obree's character cycling into a forest, slinging a rope over the branch of a tree and perching himself on the edge of a tree stump as he prepares to attempt suicide.

It is chilling, the end-product of his years of mental torture. Douglas Mackinnon's film is by no means a complex psychological portrait, but sometimes less is more. If you want the real in-depth analysis of his condition then read his compelling autobiography, Flying Scotsman: Cycling To Triumph Through My Darkest Hours.

In recent years, Obree has undergone a lengthy process of recovery. Through counselling, he has confronted the personal issues that caused the depression, including childhood bullying and the death of his brother in a car crash in 1994. He took the appropriate medication to deal with his illness and has moved on with his life.

He is currently writing a cycling guide, has started motivational speaking and enrolled in a course in outdoor activities at Langside College in Glasgow.

He is also a committed husband and father, while his cycling forays are now confined to amateur competition with local club, the Fullarton Wheelers.

He now looks back on the dark years with what borders on disbelief. "Douglas had to twist my arm to leave the depression stuff in the film," Obree said. "It just makes me cringe now. It's like seeing yourself in a pair of 1970s flares, you can't believe you were ever in that place."

Significantly, he considered attempting another cycling record last year, but decided against it: "I realised that I didn't need to try any more. I'd rather spend time with my family."

For Obree, it was never really about the cycling. So forget the famous bike made out of washing-machine parts. Forget the world records and the innovations which revolutionised the world of cycling. Graeme Obree, a Scottish sporting hero, is alive and well, healthy and happy. It might not make a film, but therein lies the real human triumph.