US President Donald Trump may have narrowly escaped immersing the United States in a broad war with Iran, at least for now, after his order to kill a top Iranian general sparked a crisis and prompted criticism at home and abroad.
When Iranian missiles rained down on bases housing US troops in Iraq on Tuesday night, a sense of foreboding swept the White House, with Trump and his national security aides shuttling in and out of the Situation Room to monitor developments as they unfolded.
Any casualties from the attack - which Iran said was retribution for the drone strike that killed Qassem Soleimani - could have forced Trump to retaliate, bringing Iran and the United States into open conflict after years of rising tensions.
By Wednesday morning, as he tweaked the wording of his televised address, Trump was relieved that he appeared to have dodged that worst case scenario while remaining wary that Iran could still respond further, aides said.
Iranian Foreign Minister Mohammad Javad Zarif had said overnight the strikes "concluded" Tehran's response to the Soleimani's killing, and influential Iraqi Shi'ite cleric Moqtada al-Sadr said the crisis was over.
"Iran appears to be standing down, which is a good thing for all parties concerned and a very good thing for the world," Trump said in a measured speech that was a marked departure from days of angry, off-the-cuff statements. He added the United Sates did not need to respond militarily to Iran's attack.
If the situation continues to de-escalate, Trump will not have to defend a military conflict with Iran while campaigning for re-election in November, after spending years blasting his predecessors' "endless wars" in Iraq and Afghanistan.
"Trump was very disciplined and very patient in waiting to see how they would react," said former House of Representatives Speaker Newt Gingrich, a Republican and close ally of the president.
"He didn't need to escalate," Gingrich said. "I think Trump is showing restraint."
The president's impulses are likely to be tested again in the coming weeks, however, as US officials warn that Iran is likely to retaliate in asymmetric ways, for example through proxy force strikes on Americans and with cyber-attacks.
And concerns about the conduct of Iran policy persist among Democrats and some Republicans on Capitol Hill.
"Members of Congress have serious, urgent concerns about the administration's decision to engage in hostilities against Iran and about its lack of strategy moving forward," said House of Representatives Speaker Nancy Pelosi, the top US Democrat.
Typical of the Trump White House, elements of chaos have dotted the week since Soleimani was killed in a drone attack ordered by Trump at Baghdad airport.
The president said he made the decision based on intelligence showing Soleimani was planning "imminent attacks" against US targets in the Middle East.
But as the days rolled by, neither Trump nor his national security team, including Secretary of State Mike Pompeo, Defense Secretary Mark Esper and national security adviser Robert O'Brien, were able to provide details.
Some of Trump's allies feared that he had dug himself a hole by claiming attacks were coming soon. Soleimani's responsibility for past bloodshed involving American forces in Iraq, they said, was justification enough.
"Five days into this and you still haven't heard anything about 'imminent danger,'" said a former senior administration official. "That means they've got a problem."
Republican Senator Mike Lee said a Wednesday briefing for senators by Pompeo and Esper left him unsatisfied and distressed, calling it the worst such briefing he had ever received.
"I had hoped and expected to receive more information outlining the legal, factual and moral justification for the attack," he said.
Trump was caught between two impulses in the weeks and months leading up to ordering Soleimani's killing, Republicans close to the White House said: He was under pressure to respond to Iranian provocations in the region, but reluctant to use force, preferring instead to stay focused on economic sanctions.
Trump has made no secret of his disdain for Republican President George W Bush's decision to invade Iraq in 2003, and he would have faced accusations of political hypocrisy if his actions and rhetoric led to a war with Tehran.
Instead, both sides appear to have found an off-ramp on the road to a conflict, at least for now.
While that should be good for Trump as he heads into his re-election campaign, he still has some convincing to do among American voters about his Iran policy.
A Reuters/Ipsos poll conducted January 6 and 7 found that 53% of American adults disapproved of Trump's handling of Iran, an increase of about 9 percentage points from a similar poll in mid-December.