The Iranian missile strike on American facilities in Iraq was a calibrated event intended to cause minimal casualties, give the Iranians a face-saving measure and provide an opportunity for both sides to step back from the brink of war, according to senior U.S. officials in Washington and the Middle East.

White House officials were bracing as early as Tuesday morning for Iran to respond to the U.S. killing last week of Qasem Soleimani, the head of Iran’s elite Quds Force.

U.S. officials said they knew by Tuesday afternoon that the Iranians intended to strike at American targets in Iraq, although it was not immediately clear exactly which they would choose.

The early warning came from intelligence sources as well as from communications from Iraq that conveyed Iran’s intentions to launch the strike, officials said.

“We knew, and the Iraqis told us, that this was coming many hours in advance,” said a senior administration official, who like others spoke on the condition of anonymity to discuss sensitive intelligence and diplomatic communications.

“We had intelligence reports several hours in advance that the Iranians were seeking to strike the bases,” the official said.

But others downplayed claims that the Iraqis had such a consequential role. A senior defense official, also speaking on the condition of anonymity, said that if the Iraqis provided warning, it certainly wasn’t hours in advance.

At the Pentagon, the most senior levels of military leadership gathered in a room in anticipation of the Iranian missiles, and soon learned they were coming.

“It was literally like right before” the Iranians launched their missiles, one senior defense official said. Defense Secretary Mark T. Esper had convened the meeting with Gen. Mark A. Milley, the chairman of the Joint Chiefs of Staff, along with senior civilian leaders of the Defense Department. Esper was pulled out of the meeting when military officials received notification that strikes were underway.

“There was a lot of concern,” the senior defense official said. “It was anxious, wanting to get updates.” Early reports did not mention any U.S. casualties, “so there was some optimism after the initial rounds.”

The advance warning gave military commanders time to get U.S. troops into safe, fortified positions at the bases.

According to military officials, troops at bases in Iraq were ordered into bunkers, donned protective gear and were told to “shelter in place.”

The troops remained in their protected positions for hours, including after the strike. One official said at least some left al-Asad air base in western Iraq before the attack. That base was targeted, along with a facility in Irbil, in northern Iraq.

“It’s not luck that no one got killed,” a second senior defense official said. “Luck always plays a role. But military commanders on the ground made good judgment and had good response.”

In an address from the White House on Wednesday morning, President Trump credited an “early warning system” for helping prevent loss of life. A defense official later said the president was referring to the radar network the military has searching for potential enemy missiles.

At least two sources of intelligence gave the United States time to prepare.

First, there were indications before the launch that Iran was preparing to strike at targets in Iraq, officials said. It was not clear whether that information came from a person or some technical means, such as intercepted communications. A defense official said the U.S. military had “clear indications” of a strike prior to launch from information “internal to [the] U.S. government.” Military officials had assessed that Iran would attempt some kind of retaliation at the end of the official mourning period for Soleimani.

The Pentagon “fully expected a retaliation from Iran,” the senior defense official said. “What that was was the issue,” the official said. “But we fully expected some sort of reaction.”

A second source of warning came from what one official described as technical means. The U.S. military has satellites that can detect a missile shortly after it is launched. U.S. officials alerted allies to the launches shortly after they occurred, according to one Western official.

Iran launched 16 ballistic missiles, including 11 that landed at al-Asad air base and one in Irbil, Esper told reporters at the Pentagon. The missile in Irbil landed in an empty area between the facility and the U.S. Consulate, according to residents who live nearby. It was not clear what happened to the four other missiles.

As a precaution after the strike that killed Soleimani, U.S. military officials deployed a brigade of about 4,500 soldiers from the 82nd Airborne Division at Fort Bragg, N.C., to the Middle East and also shuffled some forces within the region.

Commanders on the ground, overseen by Marine Gen. Kenneth F. McKenzie, head of the U.S. Central Command, also moved some service members off small bases in the region and scattered equipment and people on installations to make them harder to hit.

“Let’s get people out of less defensible areas and put them in more easily defended or better-
defended areas,” the senior defense official said, describing the thinking after the Soleimani strike. “But at the same time, let’s not overly mass our personnel as a single target.”

U.S. officials began alerting reporters to the possibility of Iranian strikes beginning at 4 p.m. Tuesday, an hour before they occurred. Vice President Pence was scheduled to conduct a television interview that evening but canceled earlier in the day.

In Iran, the regime had positioned itself for a public messaging campaign. Late Tuesday afternoon, Iran transmitted a letter to the U.N. Security Council with a legal basis for military retaliation, but it was not made public, said a diplomat familiar with the document.

Military officials were not sure, once the missiles were launched, which locations Iran had targeted.

It was hard to tell at the Pentagon which bases were under attack “until actual impact on two specific bases,” a senior U.S. military official said. “The attack spread out for more than an hour. . . . It was more than an hour from the first attack to the last attack.”

“This was not a ‘boom’ and all of this hit at once,” the senior defense official said. “This was launch, launch, launch.”

Once the bases were taking incoming fire, there was constant communication among the White House, Central Command and two other combatant commands: Northern Command and Strategic Command, the second senior defense official said. They were called in because of their expertise in monitoring and tracking ballistic missile threats.

After the missiles hit, U.S. military officials began to assess the damage.

Pentagon officials called several partner nations and allies right after the Iranian attack, part of a concerted effort to communicate with them in the wake of the Soleimani strike. While some of them questioned what the U.S. strategy is with Iran after Soleimani was killed, they were supportive and grateful for information Tuesday night, the senior defense official said.

By 7:30 p.m. Tuesday, officials at the White House had briefed Trump and were “able to pretty clearly say we don’t think any Americans are going to be killed,” the senior administration official said. “We knew that no Americans were hurt, either.”

But U.S. officials were not certain there were no fatalities until Wednesday, after service members assessed the wreckage and roll calls were taken. Esper said the missiles hit tents and a helicopter but did not cause major damage.

The lack of casualties gave administration officials more confidence that the Iranians had intended to make a public show of force largely to save face at home, the senior administration official said. The official added that a consensus is building that Iran could have done more damage.

But not all military officials were certain of Iran’s intentions. Milley, the Joint Chiefs chairman, told reporters that he assessed Iran had intended to cause material destruction and kill Americans but that an intelligence estimate had not been completed.

“I believe based on what I saw and what I know is that they were intended to cause structural damage, destroy vehicles and equipment and aircraft and to kill personnel,” Milley said. “That’s my own personal assessment.”

Asked what he made of Iran’s intentions, the second senior military official said, “You’d have to ask Iran.”

Esper and Secretary of State Mike Pompeo arrived at the White House around 7 p.m. Tuesday. About an hour later, Trump began calling lawmakers, including allies such as Sens. Lindsey O. Graham (R-S.C.) and James M. Inhofe (R-Okla.). Trump told them that no Americans had been killed in the missile attacks and that a path to negotiations with Iran had now opened, the senior administration official said.

“The president doesn’t want a war, but he doesn’t want to tolerate provocation against American interests,” Graham said in an interview with The Washington Post.

Graham said he hoped that Iran’s attack was “a show of force for domestic purposes.”

“They want a show of force,” he said, “but they want this to end, because they are scared of the president. I hope that is true.”

Matt Pottinger, the deputy national security adviser, told aides in a Roosevelt Room meeting Tuesday afternoon that it would take at least two months to understand whether the U.S. strategy was working.

“Our initial reaction has been, this was a domestic effort from the Iranians to save face, not to go to war, so we have proceeded in that vein,” said another senior administration official with knowledge of the analysis.

Esper and Milley returned to the Pentagon about 9 p.m.

Trump had told senior military officials Tuesday evening that he wanted a path to ease tensions, which had been escalating since the strike on Soleimani, the senior administration official said. A way out appeared when Trump’s military advisers told him there was reason to believe the missile strikes were not designed to kill Americans, the official said.

Even with the advance notice, U.S. military officials were still scrambling after the attack to assess the damage and determine Iran’s intentions. U.S. forces in the region remained on high alert after the strikes, but no significant troop movements have been made in Syria or elsewhere, according to military officials.

The second senior defense official acknowledged that officials on Tuesday night intended to limit information released to the public until the extent of the damage and how Trump might respond became clearer.

“We all understood that if the Iranians were to respond next, we owned the shot clock after,” the official said. “So, you need to be very thoughtful, very deliberate.”

The Pentagon and State Department sent staffers to the White House early Wednesday to write Trump’s speech. He made some last-minute additions, including the decision to start his remarks by declaring, “As long as I am president of the United States, Iran will never be allowed to have a nuclear weapon.”

“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.

A third senior administration official said there was a sigh of relief when Trump agreed to read from prepared remarks and not take questions. Some aides were concerned that Trump might deviate from the precise remarks and misspeak if he made extemporaneous remarks to reporters, the official said.

Some officials acknowledged that Iran was likely to continue attacks via proxies and other means. But there was a growing sense among administration officials that killing Soleimani had sobered Iran up to Trump’s willingness to act. “We actually believe this will be de-escalation,” the senior administration official said. “We’re obviously going to be on alert for proxies with one-off attacks. But we think this worked.”

John Hudson and Karen DeYoung in Washington and Liz Sly in Beirut contributed to this report.