The assassination of Iranian General Qasem Soleimani on the outskirts of Baghdad was a major escalation in the conflict between the United States and Iran. But the U.S. drone strike that killed the powerful commander of the Quds Force within Iran’s Islamic Revolutionary Guard Corps might claim another casualty as well: the U.S.-Iraqi relationship. Allied with both the United States and Iran, Iraq now finds itself as the frontline battleground for these two foes.

The precarious state of Washington’s relationship with Baghdad was apparent even before the United States killed Soleimani on January 3. It was thrown into stark relief on New Year’s Eve, when Iraqi security forces looked the other way as hundreds of Iraqi militia supporters attacked the U.S. embassy in Baghdad’s Green Zone. Embassy staff were kept under lockdown and U.S. Apache helicopters hovered overhead as the pro-Iranian militia supporters breached the outer cordon, burned American flags, ransacked guard posts, and sought to scale the walls before U.S. marines pushed them back with tear gas.

Such a scene would have been difficult to imagine back in 2009, when the U.S. embassy moved out of the Republican Palace and opened its current facility on the banks of the Tigris River. The U.S. embassy in Baghdad was the largest in the world, covering 104 acres and staffed with 12,000 people. It symbolized the high hopes that both countries had for the U.S.-Iraqi relationship. The United States’ reputation had suffered a blow in the aftermath of the 2003 invasion, but it recovered somewhat during the troop surge of 2007, when U.S. forces helped defeat al Qaeda in Iraq and bring Iraq’s civil war to an end. By 2009, U.S. forces had largely transferred responsibility to Iraqi security forces, and Iraqis were hopeful that their country was headed in the right direction. But then everything unraveled.

The U.S. embassy in Baghdad was the largest in the world, symbolizing the high hopes that both countries had for the U.S.-Iraqi relationship.

The trouble started in the aftermath of the 2010 elections. The United States and Iran both supported Prime Minister Nuri al-Maliki’s bid for a second term, even though his coalition didn’t win the most votes. But Maliki went on to pursue sectarian policies that created the conditions for the Islamic State, also known as ISIS, to rise from the ashes of al Qaeda in Iraq, proclaiming itself the protector of the Sunnis against Maliki’s Iranian-backed regime. President Barack Obama’s administration had hoped to keep a residual force in Iraq, but it failed to negotiate a new security arrangement when the existing Status of Forces Agreement expired in 2011, precipitating the withdrawal of all U.S. forces from the country. ISIS took advantage of the situation and by 2014 it had seized more than a third of Iraq. Only then did the Obama administration finally withdraw its support from Maliki, and, at the request of Iraq’s new prime minister, Haydar Abadi, sent U.S. troops back to Iraq with the mandate to support the fight against ISIS and to train and advise Iraqi forces.

Among the forces that battled ISIS alongside the United States was Kataib Hezbollah (KH), an Iran-backed Shiite militia that was officially folded into the Iraqi security forces through an umbrella group known as the Popular Mobilization Forces. But once the common enemy was defeated, KH turned its sights on U.S. forces in Iraq—at the direction of Iran. The Iraqi government was either unwilling or unable to stop the group from firing rockets at U.S. facilities, as it did on December 27, when it killed a U.S. contractor and wounded three U.S. military personnel at the K1 military base in Kirkuk. The United States responded to this most recent attack with air strikes intended to degrade KH’s ability to conduct future attacks by eliminating their weapon storage facilities and command and control in five locations in Iraq and Syria. But the air strikes also killed more than two-dozen KH fighters and prompted supporters of the militia to launch an assault on the U.S. embassy on New Year’s Eve.

Joining KH supporters outside the U.S. embassy were three of the strongest pro-Iranian militia leaders in Iraq: Abu Mahdi al-Muhandis, the leader of KH and deputy commander of the Popular Mobilization Forces, who was previously convicted of bombing the U.S. embassy in Kuwait; Qais Khazali, the leader of Asaib Ahl al-Haq, whose group was responsible for the kidnapping and murder of U.S. soldiers and British contractors in Iraq; and Hadi al-Ameri, the leader of the Badr Corps. After two days of protests, the militia leaders ordered their supporters to go home, claiming that they had secured the support of Prime Minister Adel Abdul-Mahdi to push forward legislation to evict U.S. forces from Iraq. Abdul-Mahdi has since denounced the U.S. air strikes on KH and condemned the assassinations of Soleimani and al-Muhandis, who died alongside the Quds Force commander in the U.S. drone strike, calling them a violation of Iraqi sovereignty and of the terms under which U.S. forces operate in the country.

Abdul-Mahdi’s response to the protests at the U.S. embassy stands in stark contrast to his government’s response to antigovernment protests that have swept the country over the last three months. Since October, tens of thousands of young Iraqis have taken to the streets of Baghdad and other cities to express their frustration with government corruption, poor public services, unemployment, and Iranian interference. Theirs is the largest grassroots mobilization since the ouster of Saddam Hussein. Demonstrators called not only for new leaders but for an overhaul of the post-2003 political system that institutionalized sectarianism and created a kleptocracy in which Iraq’s political elites divvy up the country’s oil wealth.

The aspirations of reform-minded demonstrators are likely to be drowned out by the escalating tensions between the United States and Iran.

The demonstrations forced Mahdi to resign as prime minister (although he remains in a caretaker capacity as his replacement is negotiated) and won the passage of a new election law, but not before Iraqi security forces and Iran-backed Shiite militias killed more than 500 protesters and wounded another 21,000. Taking to social media during the siege of the U.S. embassy, some Iraqis observed acidly that the pro-Iranian Iraqis carrying out the assault were the same ones they had been protesting against for months.

The aspirations of reform-minded demonstrators are likely to be drowned out by the escalating tensions between the United States and Iran. Heightened instability may prompt the government to take even harsher measures to shut down the protests, which they regard as an existential threat. Iraq’s ruling political parties have little incentive to make real changes to a system from which they benefit. For their part, Iranian leaders see control over Iraq as essential to their political survival, an economic “lung” to alleviate the crush of sanctions, and a crucial overland logistical supply link to the Syrian regime and Lebanese Hezbollah. Iran remains the most influential external actor in Iraq, with deep ties to Iraqi politicians and Shiite militias.

After the events of the last week, the Trump administration may decide that a U.S. presence in Iraq is no longer tenable, particularly in an election year. Trump has repeatedly declared his intention to withdraw U.S. troops from the region. And to many Americans, the attacks on the U.S. embassy and chants of “Death to America” conjure up memories of Tehran in 1979, when Iranians overran the U.S. embassy there and took American diplomats hostage, and Benghazi in 2012, when Libyan militants killed U.S. Ambassador Christopher Stevens. The United States already shuttered its consulate in Basra, and reduced staff in Baghdad and in the consulate in Erbil out of concern about increasing threats from Iranian-backed militia. Closing the embassy in Baghdad would be a wretched end to the U.S. relationship with a country in which it has invested so much blood and treasure. But by assassinating Soleimani, the Trump administration just made that outcome much more likely.