“Bridge of Spies,” Steven Spielberg’s new Cold War thriller, tells the gripping story of New York corporate attorney James Donovan’s leap into the labyrinthine world of high-stakes diplomacy. In February 1962, Donovan walked into Communist East Berlin, with no official protection or credentials, to negotiate a prisoner exchange. He successfully arranged the swap of Soviet spy Rudolf Abel for U-2 spy pilot Francis Gary Powers and Yale student Frederic Pryor. Spielberg’s film gets that much right.

But Donovan was not the lone ranger that Spielberg portrays. In the film, before he undertakes his daring mission, Donovan (as played by Tom Hanks) meets with legendary CIA spymaster Allen Dulles (Peter McRobbie), who makes it clear to Donovan that, while the agency supports his mission, he will be on his own. (In reality, Dulles had been ousted by then-President John F. Kennedy as CIA director by the time of the Donovan mission.) The clear implication is that if Donovan falls into trouble and ends up in a Communist cell, he might be disavowed by his own government, “Mission Impossible” style.

While this scene adds to the film’s dramatic tension, in reality, Donovan’s mission behind the Iron Curtain had the quiet — but full — support of Kennedy. He, along with Soviet Premier Nikita Khrushchev, was trying to find ways to reduce the nuclear tensions of the Stalin-Eisenhower years, when Secretary of State John Foster Dulles (Allen Dulles’s brother) kept the world on edge with his terrifying game of nuclear brinksmanship.

After Kennedy’s election in November 1960, Khrushchev said he wanted U.S.-U.S.S.R. crises, like the U-2 incident, “to become a thing of the past.” The Soviet leader hoped “a fresh wind will begin to blow” with the election of the young, new American president. In fact — as Donovan noted in his memoir, “Strangers on a Bridge,” on which the new film is based — just four days after Kennedy’s inauguration, Khrushchev freed two other U.S. Air Force reconnaissance pilots who had been shot down by a Soviet jet, an unmistakable goodwill gesture to the new president.

While Kennedy, for his part, kept an official fig leaf of deniability over Donovan’s mission to Berlin, the citizen envoy made it clear to the Communist authorities in East Berlin that he had the full backing of the president. In fact, the president, Donovan assured Ivan Schischkin (his principal Soviet negotiating partner), had already paved the way for the swap by commuting the Soviet spy Abel’s prison sentence.

Kennedy closely monitored Donovan’s progress from Washington. On the night of the carefully orchestrated prisoner exchange, the president and first lady Jacqueline Kennedy were entertaining at the White House. Among the guests was Ben Bradlee, then a reporter for Newsweek and later the executive editor of The Washington Post. Around 11:30 p.m., as Bradlee recounts in his book “Conversations with Kennedy,” the president walked across the dance floor and told him he had a “helluva story for me.” Kennedy said he had been working for months on a deal to free Francis Gary Powers. The parallel release of the Yale student, Kennedy made clear, had not been a top White House priority: “I wouldn’t have busted my ass to get him out of jail all by himself.”

After the diplomatic breakthrough in Berlin, relations between the two Cold War superpower leaders would go through their ups and downs for the rest of Kennedy’s 1,000-day presidency. But Donovan’s mission to Berlin was an important step in the delicate diplomatic dance between Kennedy and Khrushchev. Particularly after the nerve-wracking ordeal of the Cuban Missile Crisis in October 1962, the two leaders became increasingly determined to untie the nuclear knot before it was too late.

Reflecting on the searing missile crisis a few weeks later, Khrushchev charged that militarists in the United States had pushed for a nuclear confrontation, and “there began to be a smell of burning in the air.” The Soviet leader credited Kennedy with standing firm against his administration’s hardliners: “He didn’t let himself become frightened, nor did he become reckless. He showed real wisdom and statesmanship.”

In June 1963, Kennedy would extend the olive branch to the Russians in a remarkable speech at American University, encouraging Americans to regard the people they had long been taught to fear and hate as fellow members of the human race: “We all inhabit this small planet. We all breathe the same air. We all cherish our children’s future. And we are all mortal.”

As “Bridge of Spies” reveals, Donovan’s days of dramatic diplomacy did not end in Berlin. Kennedy tapped him again to negotiate the release of the 1,113 prisoners held captive by Fidel Castro following the CIA’s disastrous Bay of Pigs invasion of Cuba. With his Irish love of gab and drink, Donovan hit it off with the equally voluble Castro, and after a lengthy series of negotiations, which often stretched until dawn, a successful deal was finally struck.

Encouraged by the success of the Bay of Pigs prisoner release, Kennedy urged Donovan to seek a broader rapprochement with Castro. But the CIA was strongly opposed to JFK’s back-channel peace efforts with Havana. During Donovan’s final peace mission to Cuba in April 1963, the spy agency encouraged Kennedy’s envoy to take a wet suit to the Cuban leader, who was a scuba enthusiast. Unknown to Donovan, the “gift” had been poisoned with toxins cooked up in the CIA labs. But Donovan either brought a different skin diving suit for Castro, or the toxins failed to work, and Castro escaped one more CIA assassination attempt.

“This plot was clearly hatched without Jim Donovan’s or my knowledge,” John Nolan, Donovan’s aide on the Cuba mission, later told me in an interview for my book “Brothers: The Hidden History of the Kennedy Years.”

“Obviously, he and I were not going to be part of anything that would be injurious to Castro,” said Nolan, a young Washington lawyer who had been recruited by Attorney General Robert F. Kennedy to assist Donovan.

From Berlin to Havana, Donovan did indeed play a fascinating and — until now — barely remembered role on the Cold War stage. But he was no solitary hero. The roving citizen envoy found a willing sponsor for his peace missions in Kennedy, the leading man whom Spielberg left on the cutting room floor.

More from PostEverything: