As the United States and Iran move closer toward open confrontation, it’s important that both take quiet steps to avoid the miscalculations and misunderstandings that can lead to an inadvertent military conflict.

It’s been done before: During the Cuban missile crisis in 1962, President John F. Kennedy used a back channel to communicate U.S. resolve to the Soviets and also explore a formula for settlement. The key points of contact were his brother, Attorney General Robert Kennedy, and the Soviet ambassador to Washington, Anatoly Dobrynin. That exchange helped avoid nuclear war.

Today Washington and Tehran lack any similar means of communication in a crisis. Since the embassy takeover that followed the Iranian revolution of 1979, the two nations haven’t had diplomatic recognition. They communicate indirectly, through the Swiss embassy, which is inadequate.

So here’s a proposal in this period of deepening crisis: The United States and Iran should explore the possibility of direct contact through the sort of back channel that nations use to communicate urgent messages — namely, their intelligence services. Through this contact, each side could communicate its “red lines” in the crisis — for the United States, the insistence that Iran’s nuclear program remain peaceful; for Iran, presumably, an end to sanctions and a recognition that Iran is a significant regional power.

My nominees for this back-channel contact would be two people who have been circling each other warily for the past half-dozen years: Gen. David Petraeus, director of the CIA, and Gen. Qassem Suleimani, the head of the Quds Force of the Iranian Revolutionary Guards. These two are said to have communicated indirectly in the past about red lines in the Iraq conflict, when Petraeus was commander of U.S. forces in Iraq and Suleimani was de facto chief of Iranian activities in the country.

Some would argue that as head of the Quds Force, Suleimani is the heart of the problem — and therefore an inappropriate liaison. U.S. officials believe, for example, that Suleimani was probably aware of the plot to kill Saudi Ambassador Adel al-Jubeir that was alleged by the Justice Department in October. But precisely because Suleimani heads Iran’s most powerful intelligence network, messages through him would carry special weight.

An intelligence channel might address the problem that has frustrated past efforts to engage Iran — which is the lack of an authoritative intermediary. An offer made by one faction in Tehran is disavowed by another. That’s what happened in the fall of 2009, when President Mahmoud Ahmadinejad signaled his willingness to accept a formula for enriching uranium outside the country. But he didn’t have support from Supreme Leader Ali Khamenei, whose allies immediately began attacking the deal. It quickly collapsed.

Suleimani would be a potent contact because he reports directly to the supreme leader, and his Quds Force role trumps Ahmadinejad. Though Suleimani commands ruthless operations, he is said to be reserved and articulate in meetings. I’ve likened him in past columns to John le Carre’s fictional Russian spymaster, “Karla.” An important question, if a back channel were ever seriously considered, is whether Suleimani’s connection with the Iranian nuclear program is significant enough to make him a reliable intermediary.

The time for communication may be running out. Economic sanctions are creating a worsening crisis for Iran, one that is a potential threat to the regime’s survival. And more potent sanctions are on the way. Meanwhile, Israel, the United States and other allied nations are conducting covert actions against the Iranian nuclear program.

Iran called the assassination this week of one of its nuclear scientists another in a series of “malicious terrorist attacks.” At some point, the Iranians may conclude that the broad pressure campaign, overt and covert, means that a state of undeclared war exists — and respond in kind.

The Obama administration’s squeeze on Iran has been powerful, but also carefully calibrated. U.S. officials insist that America had nothing to do with the recent killing of Iranian scientists, for example, and their denials are credible in part because it would be so difficult for the CIA to direct motorcycle assassins in North Tehran.

The pressure campaign has international support, and there’s no reason to stop it. But this is a moment when a U.S. emissary should make clear that Iran has a choice — it can seek to be a nuclear-weapons power or remain an oil power, but not both — and communicate that to someone who can report directly to Ayatollah Khamenei.

As in the Cuban missile crisis, the message should be one of resolve — and of a desire for a settlement that avoids war.