The crack cocaine epidemic that decimated parts of Los Angeles in the 1980s had a CIA connection.

Gary Webb, a reporter for the San Jose Mercury News, broke the story in the mid-’90s and was vilified by both the government and bigger media organizations for some sloppy reporting, which was nonetheless proven mostly accurate. His fellow journalists even leaped to at least one conclusion — that the feds purposely wanted to hook African-Americans on crack — which, in truth, Webb himself never purported.

“Kill the Messenger,” adapted from Nick Schou’s book of the same name and Webb’s own memoir “Dark Alliance,” dramatizes the effort to discredit Webb, and how the Mercury News eventually had to bow to the intense pressure that was brought to bear. (Full disclosure: Although currently operated by the same company that runs the Los Angeles News Group, the Mercury News was owned by an unaffiliated newspaper chain at the time.)

Jeremy Renner, who was also one of the film’s producers, stars as Webb, who died of an apparent suicide in 2004. For the Modesto-raised actor, discovering the “Dark Alliance” story was a revelation.

“There was the story and the ripple effect of the story,” says Renner, who first read Peter Landesman’s script while he was playing comic book hero Hawkeye in the blockbuster “Avengers” movie. “Then I went, ‘Hold on a second. This happened around the corner from where I grew up and I didn’t know anything about this.’ I loved that it was a true story and thought getting it on the screen was important.”

Directed by Michael Cuesta, whose television credits include “Homeland,” “Dexter” and “Blue Bloods,” “Messenger” tells a complicated tale that even a seasoned investigative reporter could have trouble unraveling. It involves narcotics traffickers, Nicaraguan Contra supporters and L.A. cocaine kingpin “Freeway” Rick Ross; “disappearing” Central American prison informers and U.S. government whistle-blowers too paranoid to go on record; plus fine points of journalistic ethics, egos and competitiveness.

“The biggest challenge for us was to be accountable and get it right for Gary,” explains Renner, 43. “The story is giant and still hasn’t been figured out, ultimately …

“It was very tricky, because there’s a lot of information, to tell the story in a condensed amount of time, connect the dots and make it palatable for an audience to grasp what it was, but not oversimplify it too much. It’s a mountain of material.”

When the scooped and embarrassed likes of the L.A. Times and Washington Post decide to compensate for missing a story they should have been all over by discrediting Webb’s work (the Times reportedly put 17 journalists on the Mercury News writer’s case), the film also becomes a psychological study of the reporter’s increasing estrangement from the profession he lived for.

“People twisted (what Webb wrote) into: ‘He was saying the CIA did this!’ But it was not what he was saying,” Renner says. “If you read between the lines it could surely be implied and I can see why people took it down that road, but that’s not what he stated; that’s not what the articles were about. And that was, ultimately, the tragedy. … That was part of my frustration, just kind of being in his shoes. I mean, let’s be fair about things.”

Landesman is also an investigative journalist, and he suffered his own Webb-like cycle of discrediting and vindication over a New York Times Magazine article he wrote about sex trafficking. He says he re-reported the “Dark Alliance” story for his screenplay, with better sources that confirmed what Webb wrote.

However, Landesman says he could not get in touch with Jerry Ceppos, who was executive editor of the Mercury News at the time of the Webb incident and who ultimately wrote a column that criticized parts of the “Dark Alliance” series. This came as news to Ceppos, who is now dean of the Manship School of Mass Communication at Louisiana State University.

“To the best of my knowledge, no one involved in any way with the film tried to contact me,” contends Ceppos by phone from his Baton Rouge office.

Ceppos is played by Oliver Platt in the film.

“If the movie criticizes some of my reaction to the series, I would have to say that, 18 years later, I would do exactly the same thing that I did before,” says Ceppos, who had yet to see the film at the time of the phone conversation last week. “I said in my column that I thought the story had uncovered important pieces of information, but it had not really made the overall case.

“It doesn’t really matter what happened afterward. When we published the series, some things were overstated and other things were right on. That’s what I tried to say in the column. But if you know that something is wrong, it’s just incumbent on you to tell readers that. It just seems clear as day to me.”

Nonetheless, Landesman says Webb felt undermined, or even betrayed.

“I don’t villainize the Merc and the movie doesn’t,” Landesman adds. “They’re not bad people, they were in over their heads. It’s all very understandable stuff, but the exponential accumulation of it meant that Gary was suddenly, completely isolated.

“It was as if it was a story that couldn’t be told because it was too true,” Landesman reckons. “Not that it wasn’t right, not that he didn’t make mistakes, but that it was a story that challenged too much.”

For Renner, who recently finished filming the Avengers sequel “Age of Ultron” and is now working on “Mission: Impossible 5,” such messy reality is a good counterbalance to the tentpole action fantasies he also enjoys making.

“It’s not about doing a small movie by any means,” Renner says. “But there’s not as much money going into a $10 million movie as there is a $150 million movie. You can actually get it done in eight weeks instead of six months, and you can be a little more daring in the storytelling. You don’t have to whitewash it for the mass audience; you can actually tell stories that are really intelligent, or that maybe people just want to see to find out how this thing happened.”

Bob Straus has been covering film at the L.A. Daily News since 1989. He wouldn't say the movies have gotten worse in that time, but they do keep getting harder to love. Fortunately, he still loves them.