LOS ANGELES – When Shane Salerno turned 40 last year, he decided it was finally time to let his obsession go.

The screenwriter, best known for his collaborations with Michael Bay (“Armageddon”) and Oliver Stone (“Savages”), had toiled for close to a decade trying to document the mysterious life of J.D. Salinger. The author of the bestselling “Catcher in the Rye” had stopped publishing in 1965 and retreated from the public spotlight, leaving fans to wonder why – and to guess about what he had been doing in the 45 years until his death in 2010.

Over the years, Salerno had discovered juicy details about the enigmatic author – a short-lived marriage to a Gestapo informant at the end of World War II; a long-term courtship with a teenage girl that became the inspiration for the short story “For Esme – With Love and Squalor”; a previously unknown best friend with whom he had corresponded over five decades. But the biggest revelation of all? Two sources saying that Salinger had left behind five unpublished manuscripts to be released between 2015 and 2020.

The plan was to pour all the research into an exhaustive biography co-written with David Shields and simultaneously release a two-hour film. But every time Salerno thought he had uncovered it all, new information would trickle in.

At last, he had reached his limit. “I turned 40 and I was done,” recalled Salerno, sitting in his Brentwood office among the letters, photographs and documents that have consumed his life. “The film was sitting in my house as a finished master and I thought: ‘This is ridiculous, enough.’ On Dec. 3, I called my lawyer and I said, ‘I want to do this now.’ ”

Nine months later, the result is a 698-page oral biography, “Salinger,” and a documentary of the same name that’s arriving in local theaters Friday after premiering at the Telluride Film Festival. Early reviews have described both works as engrossing as well as exasperating, and time will soon tell how deeply Salerno’s passion project resonates with a wider audience.

“I always trusted that he had what he said he had,” said Salerno’s attorney, Robert Offer. “What I didn’t trust was that anyone would care as much as they did.”

The Salinger project began as a lark. Although the author’s work and mystique loomed large in Salerno’s household as a child (Salerno’s mother loved “Franny & Zooey” while her son was partial to “A Perfect Day for Banana-Fish” and “Esme”), his quest started in 2003, when he was in a bookstore and found the cover of Paul Alexander’s biography of Salinger, which featured two incongruous photos of the author superimposed – a youthful cover portrait from “Catcher in the Rye” and a candid shot taken much later at the writer’s home in Cornish, N.H. The images depicted a man young and old, optimistic and deflated.

“I was so taken with that image that I spent 9 years trying to find out what happened,” said Salerno, who originally thought he would spend $300,000 and six months investigating Salinger. He wound up using $2 million of his own money.

After a privileged New York upbringing, military school as a teen and a brief stint in college, Salinger was struggling as a writer when World War II broke out. He entered the Army and was sent to Europe; Salerno said it was Salinger’s trajectory during and after the war that kept him in the hunt for so long.

“The moment I said, ‘No matter what it takes, I’m going to finish the film,’ was when I learned that he went into a concentration camp [at the end of the war], went to a mental institution as a result and did what no other person on the planet would do: He signed up for more,” Salerno said. “He joined the de-Nazification program and decided to go hunt these guys down. The minute I heard that, I was there.” Salerno made trips to Germany, Chile and many places on the East Coast, trying to piece together Salinger’s back story.

One of the most compelling – and disturbing – segments of the film concerns Salinger’s predilection for teenage girls. The movie touches on Salinger’s early love with high-schooler Oona O’Neill, and describes his multiyear courtship of Jean Miller, whom he met at Daytona Beach, Fla., when she was 14 and he was 30. It also delves into his relationship with Claire Douglas, whom he met when she was 16 and who became his second wife and mother to his two children.

“Salinger’s interest in seeking out young girls is certainly an element in the film. But the disturbing consequences of this behavior, to the girls, is barely addressed, and the suggestion has been made that there was some kind of privilege or honor involved in having been selected as a muse,” onetime lover Joyce Maynard said in an interview. “It is my view that J.D. Salinger damaged the lives of many young girls, on a far greater scale than is represented in Salerno’s film.”