BAGHDAD — Protesters broke into the heavily guarded compound of the United States Embassy in Baghdad on Tuesday and lit fires inside to express their anger over American airstrikes that killed 24 members of an Iranian-backed militia over the weekend.
Chanting “Death to America!” thousands of protesters and militia members demonstrated outside the embassy compound, throwing rocks, shattering surveillance cameras, covering the walls with graffiti and demanding that the United States withdraw its forces from Iraq.
The American airstrikes on Sunday were in response to an Iraqi militia attack, but they have resulted in the most serious political crisis in years for the United States in Iraq, stoking anti-Americanism and handing an advantage to Iran in its competition for influence in the country.
The airstrikes targeted an Iranian-backed Iraqi militia, Kataib Hezbollah, which the United States accused of carrying out a missile attack on an Iraqi military base that killed an American contractor and wounded American and Iraqi service members. A spokesman for the militia denied involvement in the attack.
But the size of the American response — five strikes in Iraq and Syria that killed two dozen fighters and wounded dozens of others — prompted condemnation from across the political spectrum and accusations that the United States had violated Iraqi sovereignty.
Thousands of protesters marched into Baghdad’s heavily guarded Green Zone on Tuesday after prayer services for the militia fighters killed in the American strikes. While few of them were armed, many were members of Kataib Hezbollah and other groups that are technically overseen by the Iraqi military. The militia is separate from the Hezbollah movement in Lebanon, although both groups are backed by Iran and oppose the United States.
At the United States Embassy, protesters broke security cameras, covered the compound walls with anti-American graffiti and lit a guardhouse on fire. After breaking open a compound entrance, dozens of men entered and lit more fires inside while embassy security guards fired tear gas.
The demonstrators did not break into the embassy buildings, but their ability to storm the most heavily guarded zone in Baghdad prompted speculation that they had received at least tacit permission from Iraqi security officials sympathetic to their demands.
The men eventually left the embassy compound, and Iraqi police and military personnel arrived at the scene, although they did not disperse the protesters outside.
The Iraqi interior minister, Yassin al-Yasiri, said in an interview near the embassy that American attacks on an Iraqi militia had invited trouble.
“These are the dangerous ramifications of this strike,” he said. “What happened today is the danger that we were afraid of, and that the Americans should have been afraid of.”
Mr. al-Yasiri said he had coordinated with the Iraqi military and the militias to ensure the embassy’s safety and request that the militia members leave the compound.
While the protesters carried the flags of Iraq and a range of militia groups, the most prominent was that of Kataib Hezbollah, the group targeted by the United States.
A spokesman for Kataib Hezbollah, Mohammed Muhi, said his group intended to erect tents in the street in front of the United States Embassy for an opened-ended sit-in to pressure the Americans to leave Iraq.
“We will not leave these tents until the embassy and the ambassador leave Iraq,” Mr. Muhi said.
The upheaval comes at a critical time for Iraq and for the United States’ role in the country. Mass protests in recent months against poor governance have weakened the government and underscored the criticism of Iraqis who feel that Iran has too much sway over the country’s politics.
At the same time, Iran and the United States have been competing for political influence in the aftermath of the battle against the Islamic State, which once covered large areas of Iraq.
Iraqi militias, known as the Popular Mobilization Forces, formed in part to help fight the Islamic State in tandem with the national security forces, a battle that effectively put them on the side of the United States.
They have since evolved into a powerful military and political force with a significant bloc in Parliament. Some of the militias are backed by Iran and use their power to help advance its interests in Iraq.
The United States has about 5,000 troops in Iraq in addition to an unclear number of civilian contractors. The troops are tasked with training Iraqi security forces and helping to prevent a jihadist resurgence.
Falih Hassan reported from Baghdad, and Ben Hubbard from Beirut, Lebanon.