BAGHDAD — Iraqi leaders moved to quell a growing crisis Wednesday after Iranian missile strikes on two bases that house U.S. troops threatened to yank the country deeper into violence.

Iranian officials said the missile strikes early Wednesday, the most significant attacks on U.S. interests in Iraq in years, were a response to the killing of Iranian commander Qasem Soleimani in a U.S. drone strike last week. The missile strikes came amid an accelerating campaign by Iran to push out coalition troops and cement its own status as the most powerful outside influence in the country.

But Tehran’s early claim of mass casualties gave way to a flurry of statements from Iraqi officials that no military personnel had been hurt — and that, in some cases, the missiles had landed far from their apparent targets.

“We have not received any casualties so far on the Iraqi side, and we have not officially received the losses on the side of the coalition forces,” Iraqi Prime Minister Adel Abdul Mahdi said in a statement. His office said it received advance warning from Iran about the strikes, which was passed on to the Iraqi military and, from there, to the coalition.

Abdul Mahdi, the statement said, had been monitoring since the “beginning of the attack until this hour and making the necessary internal and external contacts in an attempt to contain the situation in order not to enter into an open war.”

Tensions between Washington and Tehran have increased in the weeks since an alleged Iran-backed missile strike killed an American military contractor here, accelerating the brinkmanship that led President Trump to order the killing of Soleimani.

On Wednesday, Iraqi politicians and militia leaders were scrambling to de-escalate, as Trump suggested his administration was trying to do the same. Kataib Hezbollah, a group targeted by U.S. airstrikes, said it wanted to avoid raising tensions further but would continue to focus on pressuring U.S. troops to leave.

The influential Shiite cleric Moq­tada al-Sadr said the crisis was over and urged militia groups not to carry out attacks.

“I call on the Iraqi factions to be deliberate, patient and not to start military actions, and to shut down the extremist voices of some rogue elements until all political, parliamentary and international methods have been exhausted,” he said.

But shortly before midnight, Iraq’s military said two more rockets had landed inside Baghdad’s Green Zone. Photographs from the area suggested that one had landed close to the U.S. Embassy.

The violence has sent ripples of fear through Iraq, which has suffered more than any other country in recent decades from proxy violence between the United States and Iran. On Wednesday, some residents of neighborhoods surrounding Baghdad’s Green Zone said they had packed up their possessions and left. Cars were driven through the streets at night, they said, and families were urged over loudspeakers to move to safety.

“We felt the fear of being bombed but also the fear that comes with leaving your house when you don’t want to,” said Qaissar Nassir, 23, whose family relocated from the Harthiya district to a house on the city’s outskirts. “We live in Baghdad, not a war zone. But safety comes first.”

Iraqi President Barham Salih condemned the attacks “against Iraqi military locations on Iraqi soil” and said he rejected attempts to turn the country into a proxy battlefield.

The escalating tensions have made America’s 17-year military presence here increasingly tenuous. Iraqi lawmakers have urged Abdul Mahdi to expel U.S. and coalition troops, and the prime minister told his cabinet on Tuesday that he saw their departure as one of the only plausible routes out of the crisis.

The U.S.-led coalition and NATO announced the suspension of training activities with Iraqi troops fighting the Islamic State, and some troops have already been repositioned inside and outside the country.

Although the Islamic State’s self-declared caliphate has been defeated, militants have regrouped in Iraq and Syria, mounting regular small-scale attacks in areas where security forces have limited presence.

With a pullout appearing more likely, lawmakers from Iraq’s Sunni and Kurdish parties expressed concern over potential repercussions. “Right now, the deserts of Mosul still have ISIS sleeper cells,” said Ahmed al-Jarba, a lawmaker from the northern province of Nineveh. “It’s the coalition raids that are stopping them.”

But several lawmakers who support a continued U.S. presence skipped a vote on the matter Sunday after receiving threatening messages from Kataib Hezbollah.

“The sovereignty and dignity of Iraq and its people right now are your responsibility,” read one text message confirmed by two lawmakers. “Remember, the punishment of the people will be severe.”

Other lawmakers said they feared the potential costs of expelling U.S. troops. Trump has threatened Iraq with sanctions if it follows through.

The memory of more than a decade of crippling sanctions after the 1991 Persian Gulf War still haunts Iraqis, and the idea of their resurrection has left many here deeply anxious. “We’re thinking of the economic consequences,” said Haybet al-Halbousi, who represents the central city of Ramadi.

Jarba predicted more hardship. “If they leave now, the economy will look like the broken bones of the Iraqi people,” he said. “And it will be controlled by militias with economic resources.”