HIGH NOON The Hollywood Blacklist and the Making of an American ClassicBy Glenn Frankel Illustrated. 379 pp. Bloomsbury. $28.

It’s a strange but serendipitous coincidence that two books devoted to Hollywood classics, “Casablanca” and “High Noon,” are being published at the same time. The films, released a scant 10 years apart in 1942 and 1952 respectively, are perfect bookends, spot-on reflections of the times in which they were made, and therefore dramatically different. And in the era of the Trump presidency, these books are charged by an immediacy they otherwise might not enjoy.

“Casablanca” arrived just short of a year after the United States declared war on Germany. In it, Humphrey Bogart’s Rick Blaine, whose mantra is “I stick my neck out for nobody,” famously does just that, shrugging off the neutrality that had been American policy until Pearl Harbor, and helping his former flame Ingrid Bergman and the Czech resistance hero Paul Henreid escape the Nazis. The film also includes a memorably inspirational episode of collective defiance, as the refugees, con men and adventurers in Rick’s place join in a rousing rendition of the “Marseillaise,” drowning out German officers who are singing “Die Wacht am Rhein.”

“High Noon,” on the other hand, is a profile in collective cowardice. The United States was in the grip of the Red Scare, and the marshal, Will Kane (Gary Cooper), can’t find a single good man in the dusty Western town of Hadleyville to help him confront the Miller brothers and their gang, who have sworn to kill him. Coop prevails, naturally, but his triumph fails to dispel the toxic fog of betrayal and disillusion that shrouds the story.

“We’ll Always Have Casablanca” was written by Noah Isenberg, the director of screen studies at the New School, and probably best known for a biography of Edgar G. Ulmer, a B-film director much beloved by cineastes. Here, Isenberg gives us the soup-to-nuts on “Casablanca,” dutifully making his way through script, casting, production and reception, to the inevitable squabbling over credit, all the while trying to account for its enduring popularity.

“Casablanca” was rooted in a trip that the aspiring playwright Murray Burnett and his wife took to Vienna in the summer of 1938, just after they were married. Austria had overwhelmingly voted to serve itself up to the German Anschluss that March, and was busy implementing the notorious Nuremberg Laws. Burnett quickly discovered that it was not the best place for Jews on their honeymoon. But getting out of Vienna was considerably harder than getting in, especially since Burnett, wearing diamond rings on every finger, and his wife, wearing a fur coat in August, were smuggling out valuables belonging to relatives. When they reached the South of France, they stopped at a cafe full of refugees and army officers. Burnett said to his wife, “What a setting for a play.”

Burnett developed his play with his writing partner, Joan Alison, but could not get it produced. He did, however, manage to sell it to Warner Brothers, generally known for its progressive pictures, and in particular a series of anti-Nazi films like “Confessions of a Nazi Spy,” released in 1939, when other studios were still trying to protect their German assets.

Nobody involved with “Casablanca” had high expectations for the picture, although it was written by the colorful Epstein twins, Julius and Philip, and Howard Koch. The Epsteins were widely admired for their witty dialogue, on and off screen. Of the film, Julius once said, “There wasn’t one moment of reality in ‘Casablanca.’ We weren’t making art. We were making a living.” Nevertheless, when it was released, it became an instant hit, and won three Oscars, including best picture. It’s all in Isenberg’s account, and “Casablanca” fans will find it to be a treasure trove of facts and anecdotes.

“High Noon” is a far deeper dig into the background and historical context of its subject; that is, the sorry history of the blacklist, instituted by the studios after the House Un-American Activities Committee (HUAC) put a gun to their collective heads in 1947.

Despite the voluminous literature on the subject, surprisingly little has been written about “High Noon.” For many years, Billy Wilder’s unfriendly words about the so-called Unfriendly Ten who refused to answer questions before HUAC — “Only two of them have talent. The rest are just unfriendly” — passed for the conventional wisdom. Even though Carl Foreman, who hatched the story and wrote the script, had more — and better — credits than most of his blacklisted confreres, unlike them he didn’t live to finish writing his memoirs. The director, Fred Zinnemann, never made it into the film critic Andrew Sarris’s famous Pantheon, and the producer, Stanley Kramer, was condescended to by intellectuals for his message movies.

Glenn Frankel comes to his subject with a widely praised book about John Ford’s “The Searchers” and an impressive résumé in journalism, including a Pulitzer Prize. Although much of Frankel’s material is familiar, the blacklist is a gift that keeps on giving. There always seems to be something new to chew on, in this case the transcripts of HUAC’s secret executive sessions. Besides, it’s a story that bears retelling because Hollywood, not to mention the rest of the country, is haunted by ghosts that won’t go away (witness Newt Gingrich’s recent call for a resurrection of HUAC, now to be wielded against ISIS, not Communists).

At first HUAC was considered something of a joke, but as time passed, the committee’s antics became more scary than risible. Like much of the Hollywood left, Humphrey Bogart supported the 19 “unfriendly” screenwriters initially called before the committee. He had backed Franklin Roosevelt in his 1944 presidential campaign, and when he was attacked by the right, he struck a defiant note in The Saturday Evening Post. Alluding to his role in “Casablanca,” he wrote, “I’m going to keep right on sticking my neck out, without worrying about its possible effect upon my career.” But a brief three years later, when the right turned up the heat, he published an abject apologia in Photoplay magazine entitled, “I’m No Communist,” in which he distanced himself from the Ten. Likewise, Jack Warner, whose studio had invented the anti-fascist genre, gave HUAC the names of 16 screenwriters, including those of the Epstein twins, of whom he said, “Those boys are always on the side of the underdog.” Foreman didn’t intend his script to be the blacklist parable it became, but as he watched his friends fall around him, it was almost inevitable. Foreman felt like the Gary Cooper character. He regarded “High Noon” as a picture about “conscience” versus “compromise.”

Surprisingly, it is Gary Cooper, a card-carrying conservative, who emerges as one of the few heroes of this story. Called before HUAC in the middle of production, Foreman gave his star the opportunity to leave the picture — guilt by association was de rigueur in those days — but Cooper refused. Foreman declined to name names, and Kramer fired him. In “Casablanca,” the so-called refugee trail led from Europe to America. During the witch hunt years, it went the other way. Moving to London, Foreman said goodbye to his country, his livelihood and, eventually, his marriage. Cooper tried to help him by buying stock in his new company, but bullied by the likes of John Wayne and Hedda Hopper, he eventually pulled out, albeit cordially. If Foreman had thought that art was imitating life in “High Noon,” once Cooper caved it seemed clear that at least in his life, unlike Marshal Will Kane’s, there were no happy endings.

Frankel narrates this story well. He has a sure ear for the telling anecdote, and a good eye for detail. (Parnell Thomas chaired the HUAC hearings sitting on a phone book covered by a red cushion to compensate for his diminutive stature.) The era has been labeled “the plague years,” but Frankel is forgiving of those caught up in its tangle of principle and expediency, courage and cowardice. He adopts the verdict of Dalton Trumbo, another of the Unfriendly Ten: “There were only victims.”

Correction: March 19, 2017

A review on March 5 about Noah Isenberg’s “We’ll Always Have Casablanca” and Glenn Frankel’s “High Noon” misstated the constitutional amendment under which the so-called Unfriendly Ten refused to answer questions before the House Un-American Activities Committee during its investigation of the Hollywood film industry in 1947. The 10 maintained that they were entitled to remain silent under the terms of the First Amendment, not the Fifth. (Their interpretation of the First Amendment was rejected in court, and they were cited for contempt of Congress.)