From a certain vantage point here, one might think an existential struggle between Iran and the West had indeed begun. “Lebanon is the scene of an historic test, which will determine the future of humanity,” reactionary Iranian President Mahmoud Ahmadinejad declared on July 26, and even the erstwhile pragmatist he beat in elections a year ago, the still-powerful Ayatollah Ali Akbar Hashemi Rafsanjani, railed against a U.S.-Zionist plot to “massacre defenseless Muslims.” As with the ongoing crisis over the Iranian nuclear program, the room for compromise seems limited. What looks like the regime’s interests in Lebanon–to inflict a stinging military defeat upon and fundamentally weaken Israel–are, to say the least, incompatible with those of the West.

Casting the conflict in apocalyptic terms, however, hasn’t helped resolve the nuclear issue–and won’t bring peace to Lebanon either. The Iranian regime is absolutely giddy over how the battle for public opinion is playing out; in their minds everyone except the United States is finally acknowledging the truth they’ve been bruiting about for years, that the Israelis are nothing but “butchers.” The crisis plays directly to the twin pillars of Tehran’s psychology: a pulsating sense of victimization, underscored by round-the-clock satellite TV coverage of the carnage, and a presumption of regional leadership, as Ahmadinejad has cast himself as the last true defender of Muslims. Yet analysts with ties to the Iranian leadership say the regime is worried, too–fearful that Hizbullah could be thoroughly defeated on the battlefield, and that being too closely tied to the group’s successes now could mean being dragged down by its defeat later.

My guess is that what Iran wants in Lebanon is not so different from what the regime would likely accept in the nuclear talks–some negotiated settlement that allows Tehran to save face and preserve its options. Allowing the Iranians to maintain a nuclear-enrichment program, say, or Hizbullah to hold onto its missiles, may not be healthy or acceptable to the international community, but the desire itself is hardly incomprehensible. Demonizing the regime serves little purpose.

A week in blistering Tehran reinforces the need to keep Iran in perspective. This is an autocratic state that brooks no real dissent, yet one hardly sees a traffic cop on the chaotic streets. The economy is, for all intents, a shambles; the stock market has lost 40 percent of its value in the past year–yet malls are filled with everything from iPods to Puma sneakers. At Friday prayers, much of the outrage is canned, delivered by worshipers bused in for the occasion; one group of bored Air Force conscripts barely looks up as an imam leads the crowd in “Death to America” chants.

An Iranian who advises Western multinationals on investing in the country shared a Persian saying with me last week: “You can’t carry two watermelons with one hand.” The Americans have made no secret of the fact that they’d like to see the theocracy that runs Iran gone, no less than they’d like to see Hizbullah eviscerated by Israel. And yet they expect to negotiate a satisfactory nuclear deal with a regime they’re simultaneously trying to undermine. Washington’s chances of that are no better than at pulling together a ceasefire in Lebanon–increasingly urgent politically–without Hizbullah.

The point is not to excuse Iran’s nuclear evasions or its arming of Hizbullah, but to invest Tehran in the outcome of its actions. Will Iran claim a great victory if its clients are allowed to cede authority in the south but not disarm immediately, as even Israel indicated would be acceptable last week? Of course, but after three weeks of resisting one of the world’s most powerful militaries, the guerrillas already have. A deal would at least buy the Lebanese government time to deal with Hizbullah on its own terms. It would also prevent Iran from using the issue to stall on the nuclear talks. And if the guerrillas do bring down a rain of death and destruction on Lebanon yet again, the fact that the mullahs in Tehran are to blame will be far clearer to most people in the region than it is today.