Early on in Ridley Scott's dark new thriller "The Counselor," a clueless lawyer gets a cryptic warning from a criminal who is cutting him in on a big drug deal: "The smallest crumb can devour us."

Hard-core Cormac McCarthy fans may recognize the phrase as a line from his Western novel, "Blood Meridian." There will likely be a few such fans in the audience when "The Counselor" hits theaters on Oct. 25. The movie, starring Brad Pitt, Javier Bardem, Cameron Diaz, Penélope Cruz and Michael Fassbender, comes from an original screenplay written by Mr. McCarthy, one of the country's most celebrated novelists and now a budding screenwriter.

Mr. McCarthy, a lifelong film buff, has seen several of his revered novels adapted for film but has never made an original feature film before. A lurid, adrenaline-fueled thriller about a lawyer who tries to get rich quick by dabbling in the drug trade, "The Counselor" marks a career milestone that has eluded the 80-year-old writer for decades. Mr. McCarthy has been writing original screenplays since the 1970s, but just one, a TV movie titled "The Gardener's Son," was made. His archived papers include three other finished scripts that were never made, including "No Country for Old Men," which he wrote as a screenplay before he turned it into a novel.

In the past, Mr. McCarthy has been content to let filmmakers interpret his words. But with "The Counselor," he wanted more control. He joined the production as an executive producer, and weighed in on everything from the director and cast to subtle language tweaks and final edits. He was on set for roughly 40 days of filming in London and coastal Spain. "Cormac wrote it with the intent of being involved from beginning to end," said producer Nick Wechsler, who snapped up "The Counselor" within days of reading it.

Mr. McCarthy was mostly a quiet presence on the set, but occasionally, he gave the actors instructions. "He was there every day, and if I was getting something wrong, he'd let me know," said Mr. Fassbender, who plays the unnamed attorney, in an interview. At one point, when Mr. Fassbender was shooting a tense, dialogue-heavy scene with Mr. Bardem, Mr. McCarthy corrected Mr. Fassbender on his delivery of a line that uses the poker phrase, "hole card."