WASHINGTON – In April 1959, Fidel Castro, fresh from his victory roll through the streets of Havana, came to the United States on a charm off...

WASHINGTON – In April 1959, Fidel Castro, fresh from his victory roll through the streets of Havana, came to the United States on a charm offensive.

The youthful Castro – he was only 32 – hired a public relations firm, held news conferences, answered questions, ate hot dogs. He repeatedly disavowed communism. But he was refused a meeting with President Dwight Eisenhower, and after leaving the United States he returned to Cuba and joined forces with the Soviet Union and Nikita Khrushchev.

As Sens. Barack Obama and John McCain continue their bickering about whether the next president should talk to Iran, the Castro example poses the utmost tantalizing "what if?" question: What if Eisenhower had made nice with Castro on his maiden trip to Washington? Or, more precisely, could the United States have avoided 50 years of enmity – including a brush with nuclear annihilation – if Eisenhower had just given the young revolutionary a big hug?

Not likely. Most historians say that both men needed each other too much as adversaries to see significant political benefit in early rapprochement: Eisenhower needed to show that he was standing up to the new Cuban government, which was bent on nationalizing American assets, while Castro’s own legitimacy, in many ways, was based on his anti-Americanism.

It was, in other words, a classic moment when talking to a distrusted adversary probably would have gone nowhere – the kind of moment McCain says we are going through today, when he accuses Obama of naivete in thinking there might be any use in talking directly with Iran’s current president about that country’s nuclear program.

The core of their dispute played out last month in speeches on different days before the same audience, the American Israel Public Affairs Committee. "It’s hard to see," McCain said, "what such a summit with President Ahmadinejad would actually gain, except an earful of anti-Semitic rants and a worldwide audience for a man who denies one Holocaust and talks before frenzied crowds about starting another."

To which Obama responded, the next day, that what he had in mind was doing "everything in my power" to keep Iran from getting the bomb – "starting with aggressive, principled diplomacy without self-defeating preconditions, but with a clear-eyed understanding of our interests."

Their argument echoes an issue that has been part of diplomatic history as long as there have been American diplomats. And the Eisenhower-Castro non-meeting aside, the reality is that more times than not, American presidents sweep into office proclaiming black-and-white absolutes about their foes, and end up leaving office having used everything from secret talks and back-channel negotiations to full-fledged summit meetings.

Let’s go back to Castro, for instance. Barely two years after his visit to Washington, the United States and the Soviet Union were on the brink of a nuclear showdown over the placement – at Castro’s urging – of Soviet missiles in Cuba.

John F. Kennedy and Khrushchev pounded their chests publicly. "Kennedy had favored an airstrike," Michael Dobbs writes in his book "One Minute to Midnight: Kennedy, Khrushchev and Castro on the Brink of Nuclear War" (Knopf). "Khrushchev thought seriously about giving his commanders in Cuba authority to use nuclear weapons."

But behind closed doors, the two men established a back channel. Kennedy sent a letter to Khrushchev, and his brother Robert F. Kennedy called the Soviet ambassador to Washington, Anatoly Dobrynin, to his office for a late Saturday night meeting. And with that improvisation, the world stepped back from the brink of war.

The near-miss had profound consequences. Appalled that direct discussion had been so difficult to arrange when the stakes were the highest, the two leaders set up a hot line to better control future crises and agreed to a nuclear test ban. Summit meetings, which had begun under Eisenhower with mixed results, became a ritual for all subsequent presidents. Ultimately, in Iceland, Ronald Reagan and Mikhail Gorbachev made progress toward an arms-control understanding they later signed. A diplomatic pathway had been laid that made it easier, when the time came, to manage the end of the Cold War.

One key to success seems to have been shrewdness about when a bold move might work. In 1969, Richard Nixon arrived at the White House as a national-security hawk with a history of opposing recognition of communist China. But even then, he saw an opportunity to play the China card to America’s advantage, diplomatic historians say. "He comes into office and he’s already got a plan worked out," said Michael Hunt, a diplomatic historian at the University of North Carolina at Chapel Hill. "By March, he had launched overtures to China."

Nixon’s timing was exquisite; Mao Zedong, the Chinese leader, had publicly split from the Soviet Union a few years back, and tensions along the border separating the two Communist behemoths were simmering. The North Vietnamese had just opened their own negotiations with the United States. Initially, Nixon’s dealings with the Chinese were secret, including a clandestine trip to China by Henry Kissinger in 1971.

Then Nixon stunned the world and announced he would visit China in 1972. At the Jin Jiang Hotel, Nixon and Mao signed the Shanghai Communique, pledging that the United States and China would normalize relations.

Even President Bush, perhaps the most forceful proponent of the "don’t talk to enemies" view, has shaded from black and white to gray on this issue.

After the U.S.-led invasion that toppled Saddam Hussein, Iraq was replaced on Bush’s "Axis of Evil" by Syria.

But now the Bush administration is, at some level at least, talking to all three members. Bush officials invited Syria to attend the Annapolis peace conference last year, and Syria sent its deputy foreign minister. A few months before that, in May 2007, Secretary of State Condoleezza Rice conducted a 30-minute meeting with Syria’s foreign minister, Walid al-Moallem, in Sharm el-Sheik, Egypt.

Rice, like McCain, remains adamant that the time is not right for direct talks with Iran about its nuclear program. Nevertheless, America’s ambassador to Iraq, Ryan Crocker, has had several rounds of talks with his Iranian counterparts over issues concerning Iraq.

And Bush sent a warm letter in December to North Korea’s reclusive leader, Kim Jong-il, and just last month told Congress he was taking North Korea off the list of state sponsors of terrorism, after a nuclear deal that was achieved with the help of – who else? – China.

Many foreign policy experts say they would expect McCain to be as flexible as his predecessors if he gets elected.

"They all move from the point of denouncing the enemy to swinging over to the idea that diplomacy is the way," says Hunt, the University of North Carolina historian. "It’s interesting how fast that shift can occur."

© The New York Times. All rights reserved. This article originally appeared in The New York Times.