Tensions soared between Washington and Baghdad on Monday as officials traded accusations over U.S. airstrikes against an Iranian-backed militia based in Iraq and Syria.

The Iraqi government condemned the U.S. attacks Sunday as a violation of the country's sovereignty and said it would review its relationship with the United States. U.S. officials said the Iraqis had failed to protect American troops and diplomats, and they characterized the strikes as "defensive" in nature.

"We warned the Iraqi government, many times, to carry out their responsibility to protect us as their invited guests," said a senior State Department official briefing reporters. "The U.S. military is there on the invitation of the Iraqi government, and the U.S. diplomatic presence is there under an agreement with the Iraqi government. It is their responsibility to protect us, and they have not taken appropriate steps to do so."

The strikes against Kataib Hezbollah, in which 25 militia members were killed and more than 50 injured, threaten to drag Iraq further into a proxy conflict between the United States and Iran.

But the outrage from Iraqis across the political spectrum, as well as threats of retaliation, also underlined the United States' growing isolation in Iraq and called into question the viability of about 5,000 U.S. troops in the country.

U.S. officials said the strikes were intended to deter rocket attacks such as the one targeting a military base in Kirkuk on Friday that killed an American defense contractor and injured four U.S. troops, the first U.S. casualties in an intensifying series of assaults.

“This was a defensive action designed to protect American forces and American citizens in Iraq, and it was aimed also at deterring Iran,” Secretary of State Mike Pompeo told Fox News. “This was an Iranian-backed rogue militia acting to deny the Iraqi people their basic sovereignty.”

The Iranian Foreign Ministry condemned the actions as “a clear example of terrorism,” and a top militia leader promised retaliation against U.S. forces in Iraq.

The airstrikes raised the stakes in the regionwide confrontation between Tehran and Washington that began after the Trump administration withdrew from a 2015 nuclear agreement and launched its “maximum pressure” campaign of economic sanctions against Iran. The sanctions have devastated Iran’s economy and led the government to start pulling back from its commitments under the deal.

The United States has responded by adding more sanctions, but the lack of a U.S. military response apparently has given the rulers in Tehran more confidence to launch attacks targeting the United States and its allies — 11 in the past two months alone.

Two weeks ago, Pompeo warned Iran of a “decisive U.S. response” if the regime or its militias harmed American troops or allies in the region.

U.S. officials said Monday that the policy of “strategic patience” has its limits.

“We very much hoped that Iran would not miscalculate and confuse our restraint for weakness,” said Brian Hook, a special envoy for Iran. “But after so many attacks, it was important for the president to direct our armed forces to respond in a way that the Iranian regime will understand.”

Hook said the mission was one of “restoring deterrence.”

David Schenker, the assistant secretary of state in charge of the Middle East, pushed back on the notion that the United States had violated Iraq’s sovereignty.

“If there was a violation of sovereignty, [it] occurred on Friday when Iranian-backed forces basically shot missiles, rockets at an Iraqi military base,” he told reporters.

But Iraq is finding its position between Washington and Tehran increasingly uncomfortable. Acting prime minister Adel Abdul Mahdi warned that there would be “dangerous consequences” after Sunday’s retaliatory airstrikes.

The condemnation came from many factions, as Iran and its allies intensified calls for U.S. troops to leave Iraq. Protesters waging a three-month-old campaign against the government burned American flags and expressed solidarity with the victims of the strikes.

At an emergency session of the Iraqi National Security Council, ministers and security officials described what they called a “grave violation” of rules governing the presence of U.S. troops in Iraq, according to a statement issued after the meeting. Iraq will revisit the status of U.S. troops in the country, the statement said. 

The militia’s allies warned of retaliation.

“The blood of the martyrs and the wounded will not go in vain, and the response will be harsh for the American forces in Iraq,” said Jamal Jaafar Ibrahimi, deputy head of the Popular Mobilization Units, of which Kataib Hezbollah is a part. He is a powerful ally of Iran who is better known by his nom de guerre, Abu Mahdi al-Mohandis.

The sanctions are intended to force Iran to reopen negotiations on the nuclear deal, but they have prompted the country to embark on what it has described as a campaign of “maximum resistance.” The campaign has embroiled international shipping in the Persian Gulf and, increasingly, U.S. troops in Iraq.

The retaliatory strikes, the first time the United States has used military force against an Iran-linked target since the U.S. troop withdrawal in 2011, were intended to send a signal to Iran that the United States will no longer stand by while its troops in Iraq face danger, U.S. officials said. The United States sent troops back to Iraq after 2014 to fight the Islamic State militant group, and about 5,000 of them are based there.

But with both sides now having drawn blood, there is a risk that U.S. troops will either be swept into an escalating tit-for-tat exchange of fire with Iran’s proxies in Iraq or face increased pressure from Baghdad to pull out of the country altogether, said Renad Mansour, director of the Iraq initiative at the London-based Chatham House think tank.

Whereas both Iran and the United States seemed intent on avoiding escalation in the past, that no longer seems to be the case, Mansour said. “Does this mean a new norm in U.S.-Iranian relations in Iraq, which is that they are both willing to destabilize a country they have spent many years trying to stabilize?” he asked.

Alternatively, he said, Iran and its allies are likely to step up pressure for the removal of U.S. troops from Iraq. Although some Iraqis still want U.S. troops to remain as a counterbalance to Iran, “it’s going to become more difficult for Iraqis advocating an American presence to make their case,” Mansour said.

The Iranian Foreign Ministry said the attacks showed that the United States was a source of conflict and tension in Iraq and would have to pull its forces out. “America must put an end to its occupying presence,” Iranian government spokesman Abbas Mousavi said.

Iraq’s political leaders, who have sought to balance alliances simultaneously with Iran and the United States, also condemned the strikes.

In a half-hour phone call Sunday, Abdul Mahdi urged U.S. Defense Secretary Mark T. Esper not to go ahead with the strikes, warning that they would “lead to further escalation,” Maj. Gen. ­Abdul-Karim Khalaf, a spokesman for Abdul Mahdi, told the Iraqi News Agency.

At the same time, Iraqi President Barham Salih expressed his opposition to the strikes in a telephone call with the U.S. Embassy, calling them “harmful to Iraq and . . . unacceptable,” the news agency said.

Other major political blocs and leaders also issued statements condemning the strikes, including the powerful cleric Moqtada al-Sadr, who said he would lead a campaign to expel U.S. forces by “legal and political means.”

Grand Ayatollah Ali Sistani, Iraq’s top Shiite cleric, issued a statement calling the U.S. action “sinful” and without justification.

U.S. officials noted that there were no statements of condemnation after the rocket attack that killed an American in Kirkuk, and they seemed dismayed by Iraq’s angry reaction. “It’s disappointing. But it’s moments like this when you see people’s true colors,” said a senior State Department official, who spoke on the condition of anonymity to brief reporters.

Iran probably calculated that U.S. retaliation for the rocket attacks would trigger Iraqi fury, and it will now be hoping to win new support for efforts by its allies in the Iraqi parliament to force a withdrawal of U.S. troops, said Sajad Jiyad, who heads the Bayan Center think tank in Baghdad.

“This time around, there could be more grounds for this, and, not immediately, but I think the Americans will leave. There’s not much value in them being in Iraq, where they are not protected or welcome,” Jiyad said.

Sly reported from Beirut.