Just over a month ago, President Barack Obama broke a 30-year embargo on US relations with Iran: he offered goodwill not only to "Iranians" but to the country's government. Speaking on the occasion of Nowruz, the Iranian New Year, he said:

"I want you, the people and leaders of Iran, to understand the future that we seek. It's a future with renewed exchanges among our people, and greater opportunities for partnership and commerce. It's a future where the old divisions are overcome, where you and all of your neighbours and the wider world can live in greater security and greater peace."

It's no surprise that this message, given a generation of tension between Washington and Tehran, has been challenged in the US. What's more interesting is that the greatest threat to Obama's engagement comes not from media sceptics from Fox News to the Wall Street Journal or the foundations now packed with refugees from the Bush administration or even the Middle Eastern institutes putting a priority on Israeli security. No, Obama's most daunting opponents are within his own administration.

Less than two weeks after the Nowruz address, General David Petraeus, the head of the US military command overseeing Iran and the Persian Gulf, offered a far different portrayal of Iran to a Senate committee:

Iranian activities and policies constitute the major state-based threat to regional stability. … Iran is assessed by many to be continuing its pursuit of a nuclear weapons capability, which would destabilise the region and likely spur a regional arms race.

The next day Petraeus's boss, Admiral Mike Mullen, the chairman of the joint chiefs of staff, visited the offices of the Wall Street Journal, which has taken a consistent editorial line against dialogue with the Iranian government. Far from supporting his president, Mullen told the newspaper: "I think we've got a problem now. ... I think the Iranians are on a path to building nuclear weapons." Not even past enemies were as menacing: "Even in the darkest days of the cold war we talked to the Soviets. … [But now] we don't have a lot of time."

What's going on here? There are clear political goals behind Obama's approach of dialogue rather than confrontation. The hope is that Iran will not challenge the US approach to Middle Easten issues, in particular Israel-Palestine and Israel-Syria talks, through its connections with Hamas and Hezbollah. An easing of political tensions in turn may remove the motive for Tehran to reverse its suspension of research and development for a nuclear weapons – as opposed to civilian nuclear energy – programme.

Yet there are also military benefits from a US-Iran rapprochement. As Obama's envoy Richard Holbrooke has made clear, a partnership with Tehran could ease the American burden in Afghanistan, especially as the troop surge is being implemented. Better relations could assist with the political transition in Iraq as the US draws down its overt military presence. Eventually, an Iranian renunciation of nuclear weapons would finally remove a significant strategic question mark in the region.

In part, the calculation of Petraeus and Mullen is that Iran cannot be trusted in these areas. For years, US commanders in Iraq have alleged that Iran has been backing the insurgency, and Petraeus has also claimed that Tehran has supported the Taliban in Afghanistan. In his testimony to the Senate committee, the general expanded this into a grand nefarious Iranian scheme:

Iran employs surrogates and violent proxies to weaken competitor states, perpetuate conflict with Israel, gain regional influence and obstruct the Middle East peace process. Iran also uses some of these groups to train and equip militants in direct conflict with US forces. Syria, Iran's key ally, facilitates the Iranian regime's reach into the Levant and the Arab world by serving as the key link in an Iran-Syria-Hezbollah-Hamas alliance and allows extremists (albeit in smaller numbers than in the past) to operate in Damascus and to facilitate travel into Iraq.

Still, in their public opposition to Obama's Iran policy, the military commanders are playing one card before all others: Israel.

Petraeus's threat to the congressmen was far from subtle: "The Israeli government may ultimately see itself so threatened by the prospect of an Iranian nuclear weapon that it would take pre-emptive military action to derail or delay it." Mullen told the Wall Street Journal: "There is a leadership in Israel that is not going to tolerate" a nuclear Iran. This was a "life or death" matter in which "the operative word is 'existential'".

While Ashkenazi was told by Obama's political advisers to put his fighter planes away, the story of Israeli military plans continues to be circulated. Only last weekend, Sheera Frenkel was fed the story: "The Israeli military is preparing itself to launch a massive aerial assault on Iran's nuclear facilities within days of being given the go-ahead by its new government."

So, for this moment, Petraeus and Mullen appear to have been checked. However, they and their military allies, such as General Raymond Odierno in Iraq, have been persistent in challenging Obama over strategy from Kabul to Baghdad to Jerusalem. It is their manoeuvring, rather than Tehran's jailing of an Iranian-American journalist like Roxana Saberi or even Iranian President Mahmoud Ahmadinejad's speeches at UN conferences, that is Barack Obama's greatest foe.