Credit: George Danby

Before our national attention span flits heedlessly toward impeachment, the Iowa caucuses and Megxit, it’s worth pausing to remember that the United States was on the brink of war with Iran last week.

Two adversaries that barely speak to each other managed to avoid catastrophe — but there’s still plenty to worry about.

President Donald Trump set a new red line: Iranian-sponsored acts that harm U.S. citizens will draw retaliation.

Iran lost a top general but reaped an unexpected dividend: Iraq’s parliament, angered by U.S. missile strikes on Iraqi territory, voted to order U.S. forces to leave. The vote was nonbinding, but the Trump administration faces a new problem.

By week’s end, Washington and Tehran returned to the shadow war they’ve conducted for the past 40 years: U.S. economic sanctions against Iran, and Iranian proxy strikes against U.S. interests in the Middle East.

But it’s not the same old stalemate. It’s worse, for two reasons.

First, Iran has moved closer to a long-held strategic goal: forcing the United States out of Iraq — and eventually the rest of the Middle East.

Iranian President Hassan Rouhani said that “the real revenge” for the U.S. killing of Gen. Qassem Soleimani on Jan. 3 would be “when America is expelled from this region and its hand of aggression is cut off forever.”

Iran’s allies in Iraq are trying to help him get his wish. After Baghdad’s parliament passed a resolution to expel U.S. troops, Iraq’s caretaker prime minister, Adel Abdul Mahdi, asked Secretary of State Michael R. Pompeo to send a delegation to start planning a U.S. withdrawal.

The State Department dismissed that request, saying U.S. troops were staying and arguing that most Iraqis don’t want them to leave. This story isn’t over.

“A U.S. withdrawal would be a major Iranian victory,” Douglas Ollivant, who worked on Iraq strategy under Presidents Obama and George W. Bush, told me. “What’s happening [in Iraq] is far beyond Iranian expectations.”

Ironically, getting U.S. troops out of the Middle East is one of the few goals Trump has in common with Iran’s Islamic leaders. But he probably doesn’t want to leave this way — run out of Baghdad while Iran’s influence grows. Indeed, he threatened to impose sanctions on Iraq, a U.S. ally, if it tries to force U.S. troops out.

Second, leaders in both countries say they support diplomacy, but their brush with war worsened the prospects for negotiations.

Trump said he was “ready to embrace peace with all who seek it,” and Pompeo directed U.S. embassies to avoid meeting with armed Iranian opposition groups because it could be “counterproductive to our policy goal of seeking a comprehensive deal with the Iranian regime.”

Iran tried to sound reasonable, too. Rouhani talked with French President Emmanuel Macron, who has tried — without success — to play the role of mediator in the past.

And Iran asked the prime minister of its Muslim neighbor Pakistan, Imran Khan, to intercede with Trump — an intriguing move, since the former cricket star seems to have a good relationship with the president.

But none of that appears likely to get very far.

Trump and Pompeo have shown no sign they would meet Iran’s long-standing condition for negotiations — an easing of U.S. sanctions that have crippled Iran’s economy. Indeed, Pompeo announced several new sanctions Friday, adding to more than 1,000 already in place.

Iran’s supreme leader, Ayatollah Ali Khamenei, has called Trump “unstable,” “a bully” and an unreliable negotiator. “Who would negotiate with a country that has ignored all other agreements?” he asked last year.

Iran-watchers think Khamenei wants to see Trump lose reelection this fall — not because the ayatollah likes the Democratic candidates, but because he wants Trump to fail, especially after the death of Soleimani.

“The Iranians may well have decided on a strategy of regime change,” John W. Limbert, who was one of 52 American diplomats and citizens held hostage for 444 days in Iran in 1979 and 1980, told me.

Iran doesn’t want to give Trump the domestic political boost he might gain from a summit meeting with one of its leaders.

“It’s pretty hard to see bright prospects for negotiations right now,” Limbert said. “The Iranians are going to want an outcome they can paint as a victory. They want to say that they brought the Americans to their knees. That doesn’t sound like something the Trump administration would be interested in.”

Iran’s leaders are in no mood to make concessions to Trump. Instead, they may look for ways to make him a one-term president, just as they believe the hostage crisis doomed President Carter’s reelection bid in 1980, perhaps even by sparking a new crisis before November.

Until then, both sides will need careful diplomacy to keep hostilities from escalating again. Our week of almost-war ended not in peace — only a tenuous, makeshift cease-fire.

Doyle McManus is a Washington columnist for the Los Angeles Times and director of the journalism program at Georgetown University.