David Walsh, the multi-award-winning journalist responsible for exposing champion cyclist Lance Armstrong as a drug-taker, is bubbling with excitement. He is about to see a preview of the movie depicting the scandal, which will give him the rare, if daunting, experience of watching someone portray him on screen.

The film, directed by Stephen Frears and as yet without a title, stars Ben Foster as Armstrong with the Irish actor Chris O'Dowd playing Walsh. It is based on his book, Seven Deadly Sins: My Pursuit of Lance Armstrong, which was published last year. Walsh is most enthused, however, about Dustin Hoffman having a small part. "I love that," he says, "because he was in All The President's Men." That ranks as one of the best movies ever made about reporters struggling to tell the truth in the face of widespread scepticism, Walsh's own experience.

Although he would not dare to compare himself to Bob Woodward and Carl Bernstein, it is not stretching matters to do so. He spent 13 frustrating years trying to tell the truth about the man considered to be one of the world's greatest sporting heroes. Armstrong was feted for winning the Tour de France seven times, among other achievements, and was lionised for his victories on returning to cycling after surviving cancer and founding an international cancer charity, now known as the Livestrong Foundation.

By the time Armstrong returned from illness to win the 1999 tour, Walsh already knew he was guilty of doping. In fact, he says, "it was all a drug-addled circus and journalists who also knew that were part of the fraud, reporting on the cyclists as if they were heroes when they knew they were not". He recalls phoning his Sunday Times sports editor, Alex Butler, to tell him that Armstrong had won by using drugs. "Alex said, 'oh no' because he was dreading the reaction from readers," says Walsh, who wasn't able to do much more than raise suspicions at the time. "I suffered vitriol from people for that piece. One wrote to say, 'you have the worst cancer of all – cancer of the spirit.' That really penetrated my exterior wall."

Butler prevailed on him to obtain evidence and the modest Walsh, who always stresses that he is a sportswriter and not an investigative journalist, says he had no idea how to go about the task. In fact, as he recounts the way in which he pursued the story, following up clues, building the confidence of contacts and hunting down more sources, it amounts to an object lesson in investigative journalism. Meanwhile, most of the other journalists who covered cycling – scathingly referred to as "fans with typewriters" – looked away. "That played into my hands," says Walsh, "because they preferred to pass on witnesses and whistleblowers to me."

In 2001, Walsh confirmed a crucial connection between Armstrong and an Italian doctor, Michele Ferrari, who was under investigation for supplying performance-enhancing drugs to cyclists. His big breakthrough was in persuading Armstrong's masseuse, Emma O'Reilly, to tell what she knew. Her accusations were the centrepiece of Walsh's book, L.A. Confidential, written with a French sports journalist, Pierre Ballester, in 2004.

Though the book was published in France, it fell foul of English libel laws. Instead, Walsh wrote an 11,000-word treatment of it for the Sunday Times, an episode that says a great deal about his strength of character. The Sunday Times's lawyers advised that it was impossible to publish. "It was explosive stuff," recalls the paper's then deputy sports editor, Alan English. "The lawyers said the risk was too great."

Walsh protested that it was all true, prompting the lawyer, Alistair Brett, to respond with that well-known legal catch-22: "The greater the truth, the greater the libel." Once he realised that the paper would not use his piece, Walsh resigned. "It was incredibly sad. I was so upset." English says: "He was so distraught. He felt he had let down his sources and thought it was the only honourable course of action. He is so determined and principled."

It says much for how highly they regarded Walsh that Butler, English and the paper's then editor, John Witherow, agreed a compromise. English rewrote Walsh's article, subbing it down to 2,200 words, and then persuaded his friend and colleague to rescind his resignation. Yet despite the article being given a legal OK, Armstrong sued successfully for libel, costing the paper more than £1m in damages and costs (the Sunday Times and Walsh reached a "mutually acceptable" but confidential settlement in August 2013 with the by now disgraced cyclist). Back then, says Walsh, "journalists would dismiss me, saying 'David, you've produced only circumstantial evidence.' So I kept asking them, 'what's the difference between circumstantial and direct evidence?'"

In May 2010, he was trekking in the Himalayas when he received a call from Butler in London. One of Armstrong's former teammates, Floyd Landis, had admitted to doping and accused Armstrong of the same. Walsh took six hours to reach an internet cafe. "It was the most enjoyable walk I've ever made in my life, knowing I was going to write the story I'd waited six years to tell." Armstrong's lies began to dissolve from that point on as the journalist revealed more details of the doping conspiracy involving his cycling team.

Walsh admits to having been obsessed during the years when he was prevented from telling the truth. He remembers an incident in an airport queue when he spotted a man wearing a Livestrong wristband. "I went up to him and said, 'do you realise that the guy you're supporting is a complete fraud?' He looked at me as if I was an alien and stepped back in the queue to get away from me.

"People often talk about me having remarkable perseverance. But it was easy for me to persist. I know this comes across as arrogance, and I really don't want that, but I always knew I was on the side of the truth, so it wasn't a challenge to persevere. It was just natural. I thought, 'people just have to know this guy is a liar and a fraud.'"

Walsh accepted from early on in his journalistic career that telling the truth could prove unpopular. As a young reporter on the Leitrim Observer in the west of Ireland, he spotted a Gaelic football player committing a violent foul. He was the only journalist to see it and report it, even though he knew readers – and the man responsible – would be upset. He had dreamt since the age of six of being a sportswriter and has revelled in being able to cover a range of sports: football, golf, rugby, athletics, horse-racing and, of course, cycling.

"I just hope I never stop being a journalist," he says. "The sportswriting is fine but journalism is all about that business of comforting the afflicted and afflicting the comfortable. That's what we should be doing." It appears that he's about to become unpopular all over again. Next week, he reveals, "I'll be pursuing a fantastic story of corruption in British sport. It will appal people and I know it will be incredibly difficult to get into print." He confided some details and I can see why it is likely to prove explosive. Alex Butler, be prepared.