Javier Bardem and Cameron Diaz star in "The Counselor," by Cormac McCarthy. 20th Century Fox

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.

The author, on location in Spain. Nick Wall

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.

Next month, famed novelist Cormac McCarthy will get his first screenwriting credit with "The Counselor". Alexandra Alter discusses why he took a more active role with this film after years of letting others adapt his work for the big screen. Photo: 20th Century Fox.

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."

The resulting film hews closely to Mr. McCarthy's original vision, and could reshape his reputation as a writer and storyteller. McCarthy fans and scholars are already sharply divided over the screenplay for "The Counselor," which will be published next week. Some have pronounced it a brilliant and profound morality tale in league with his novel "No Country for Old Men." Others have dismissed it as "the worst thing McCarthy has ever written."

From Novel to Screenplay

A look at legendary novelists who made the foray into screenwriting. Cannon Films/Everett Collection

The film adds a new chapter to the author's nearly 50-year career. Mr. McCarthy's works have won major literary awards and sold millions of copies. He's known for his dense, borderline Biblical prose, which is peppered with words like "haruspices," "paraclete" and "pinchbeck," and his poetic descriptions of extreme violence. But in Hollywood, he is still an unproven, novice screenwriter—albeit one with a mammoth literary reputation.

"The Counselor" came as a surprise to Mr. McCarthy's publisher and his literary agent, Amanda Urban. In January 2012, Ms. Urban received a package from Mr. McCarthy. She was expecting a novel and instead found a 180-page screenplay. She called Mr. McCarthy and asked where the story came from. He explained that he needed a break from the two novels he was working on and wanted to knock out something quickly. He wrote the screenplay in five weeks, he told her.

Ms. Urban immediately sent the script to Mr. Wechsler and Steve Schwartz and his wife, Paula Mae Schwartz, the three producers behind the 2009 adaptation of Mr. McCarthy's most recent novel, the post apocalyptic drama, "The Road." They made an offer several days later. Industry publications blasted the news that Mr. McCarthy had written his first "spec script." Mr. Scott, director of blockbuster films such as "Alien," "Blade Runner," and "American Gangster," got hold of the script and flew to New Mexico to meet with Mr. McCarthy. They met for several hours and discussed their storytelling philosophies. Mr. Scott asked Mr. McCarthy not to take meetings with any other directors and promised to make "The Counselor" his next film. Production began six months later, a remarkably fast track to development in an industry where the migration from page to screen can take years.

With Ridley Scott directing, the project was quickly cast with international superstars including Cameron Diaz. 20th Century Fox

"The Counselor" is also being treated as a literary event in its own right. Vintage is releasing it as a paperback on Oct. 15, 10 days ahead of the film's opening. "The script reads like a novel," says LuAnn Walther, editorial director of Vintage/Anchor Books. "We expect readers will come to the screenplay in the same way they do to his novels."

"The Counselor" certainly bears the markers of Mr. McCarthy's literary DNA. The story opens in El Paso, Texas, on the border between Texas and Mexico, where an unnamed lawyer, played by Mr. Fassbender, spends a carefree afternoon in bed with his girlfriend, Laura, played by Ms. Cruz. The rest of the story unfolds as swiftly and relentlessly as a Greek tragedy. The counselor, ignoring warnings that he is dealing with vicious criminals who, in the words of one character, "will rip out your liver and eat it in front of your dog," gets involved in a deal to import cocaine from Colombia to Chicago in a septic tank truck. The truck goes missing and everything unravels.

The film is a strange hybrid with few antecedents in Hollywood: a sex and violence-filled drug thriller with shadowy characters who have abstract, philosophical discussions about fate, mortality and the nature of greed. At times, it seems like characters from a Samuel Beckett play wandered into a Quentin Tarantino film.

Mr. McCarthy is famously reticent about his work and declined to

Brad Pitt and Michael Fassbender 20th Century Fox

be interviewed about the film. In a statement released by the film's distributor Twentieth Century Fox, Mr. McCarthy said he created the counselor as an archetypal figure who is felled by his own ignorance and greed: "He's a decent man who gets up one morning and decides to do something wrong," Mr. McCarthy said. "And that's all it takes."

Some McCarthy scholars are skeptical that the screenplay will stand up to his novels. "It doesn't read like vintage McCarthy to me," says Stacey Peebles, an English professor at Centre College in Danville, Ky., who has written about McCarthy and film and read the screenplay. "McCarthy writing a sex scene is maybe not a great idea," she added.

A few industry insiders were even more cutting in their critiques of Mr. McCarthy's debut when a copy leaked out. "Boring as hell story with stilted dialogue," one commenter wrote on ScriptShadow, a site that posts reviews of Hollywood scripts. Roger Balfour, a McCarthy uberfan who reviewed "The Counselor" for ScriptShadow, said he read the script twice and was still confused. "There are definitely parts where I thought it could be clearer, but who am I to criticize Cormac McCarthy?" Mr. Balfour said.

Penelope Cruz 20th Century Fox

Mr. McCarthy's name and talent haven't always guaranteed acceptance in Hollywood. He's written at least five scripts, but just two have been made: "The Gardener's Son," a TV movie that aired on PBS in 1977, and "The Sunset Limited," a 2011 production for HBO that Mr. McCarthy adapted from his own play. His papers in the Wittliff Collections at Texas State University in San Marcos include three complete original screenplays that were never made. He wrote "No Country for Old Men," as a screenplay in the 1980s, then published it as a novel some 20 years later. In its original script form, the bloody Western had a happy ending—by McCarthy standards—with the killer brought to justice. He went through a similar process with "Cities of the Plain," a 1950s Western. He wrote it as a screenplay, then reverse adapted into a novel, which was published in 1998. Another script, "Whales and Men," is a meandering parable about human nature and empathy that follows a group of friends as they witness a whaling that leaves a baby whale orphaned.

In a 1985 letter to his friend Howard Woolmer, Mr. McCarthy described the appeal of screenwriting: "I'm working on a couple of stories in filmscript form. Very good form for conserving the word," he wrote.

When his literary career took off, Hollywood finally came to him. His first five novels sold fewer than 5,000 hardcover copies each. Then in 1992, his novel "All the Pretty Horses" won the National Book Award and became a best seller. Billy Bob Thornton directed the movie, starring Matt Damon and Penélope Cruz. Mr. McCarthy was less than thrilled with the film, which was a critical and commercial disappointment. "The director had the notion that you could put the entire book up on the screen. Well, you can't do that," he said in a 2009 interview with The Wall Street Journal.

Since then, Mr. McCarthy's record in Hollywood has been mixed. Joel and Ethan Coen's 2007 adaptation of "No Country for Old Men," won four Academy Awards and grossed around $74 million in the U.S. Two years later, a $25 million adaptation of Mr. McCarthy's Pulitzer Prize-winning novel "The Road" got tepid reviews and grossed just over $8 million domestically.

Mr. McCarthy had little influence on those films, and didn't seek it.

Actor James Franco, who adapted "Child of God," Mr. McCarthy's 1973 novel about a necrophiliac, into an independent film that recently made its debut at the Toronto Film Festival, says Mr. McCarthy offered little guidance. "He doesn't give any answers about his work," Mr. Franco said in an interview. When Mr. Franco called Mr. McCarthy and asked why he had written a book about such a repellent character, he was glib. "He said, verbatim, 'I don't know, James, probably some dumb-ass reason,'" Mr. Franco recalled.

Mr. McCarthy's history of standoffishness makes his deep involvement with "The Counselor" all the more noteworthy. "This was an opportunity for him to get his vision on the screen unfiltered," said Mr. Schwartz, a producer for "The Counselor" and "The Road."

Working off a script from a literary giant has advantages and drawbacks. Mr. McCarthy's name will likely draw legions of book lovers to theaters. But guarding against plot spoilers could prove nearly impossible when the screenplay hits bookstores before the film opens.

Mr. Wechsler says most people know better than to expect a happy ending from a Cormac McCarthy story, anyway.

"If you're at all familiar with Cormac's writing, you kind of know it's going to be an emotional train wreck," he says.

Write to Alexandra Alter at alexandra.alter@wsj.com