Dozens of attacks on U.S. military facilities by Iran-backed factions in Iraq over the past two months as the Israel-Hamas war has raged have forced Baghdad into a balancing act that’s becoming more difficult by the day.

A rocket attack on the sprawling U.S. Embassy in Baghdad on Friday marked a further escalation as Iraqi officials scramble to contain the ripple effects of the latest Middle East war.

Iran holds considerable sway in Iraq and a coalition of Iran-backed groups brought Iraqi Prime Minister Mohammed Shia al-Sudani to power in October 2022. At the same time, there are some 2,000 U.S. troops in Iraq under an agreement with Baghdad, mainly to counter the militant Islamic State group.