The US military on Wednesday will officially end its anti-ISIS operations in Iraq, concluding a 12-year mission to defeat the Islamist extremists.
Operation Inherent Resolve was, by many measures, a success. ISIS is now reduced to a shadow of its former self, its self-proclaimed "caliphate" in Syria and Iraq long gone.
But the completion of the latest chapter of America's military involvement in Iraq, which dates back to the 1991 Gulf War and then the 2003 US-led invasion, comes with no guarantee that Baghdad faces a simpler security situation in the future.
Although ISIS has been diminished to a low-level insurgency, the US withdrawal brings new challenges for both Baghdad and Washington, particularly as it pertains to Iran.
On the one hand, pulling US forces out removes a main target for Iran-backed militias, potentially breaking a cycle of tit-for-tat violence with the US, something that could make Iraq more stable in the short term.
But the withdrawal of US forces also marks the end of a key check on Iranian influence. Tehran spent years expanding its ties with Iraqi political groups, security forces and the Popular Mobilisation Forces, and Iranian attention will likely only grow now the US has moved on.
“The Iranians are maintaining interest in Iraq, and the US is losing interest," said Michael Knights, an adjunct fellow at the Washington Institute and the head of research at Horizon Engage, a New York-based strategic advisory.
"Whenever that happens, it's not a good outcome, typically," he added.
Jason Campbell, a senior fellow at the Middle East Institute, said the withdrawal would have at least one potential benefit.
“By the US leaving, if there's one sort of silver lining, it's depriving the justification many of these [Iran-backed] groups have used for maintaining their arms in the first place.”
But in the short term, there would be “some degree of public relations win for Iran and its proxies and allies in Iraq”, he added, while warning of new vulnerabilities in parts of the country.
Mr Campbell cautioned against assuming that the departure of US troops would automatically mean the end of American influence in Iraq.
“I don't know that the presence of a few hundred US forces had all that much impact as much as their overarching desire by both Erbil and Baghdad to stay on Washington's good side,” he said.
Without US bases around Erbil, Mr Campbell noted that the Kurds face added vulnerability, particularly because they will lose the air defences that had protected US forces in the region.
In recent years, Iraq has maintained close political and military relationships with both the US and Iran, which sometimes used Iraqi territory as a proxy battlefield.
Prime Minister Ali Al Zaidi set an initial deadline for Iran-backed militias to be disarmed by September 30, but that has already been pushed to the end of June 2027.

Mr Knights said that while Washington views Mr Al Zaidi as inexperienced, it will adopt something of a laissez-faire attitude in terms of disarming Iran-backed militias, provided they don't attack US interests.
"The US, I think, is saying, as long as we don't have rocket and drone attacks coming out of Iraq or against our embassies in Iraq, we can cope with the existence of the militias," he said, arguing that the Trump administration has taken a pragmatic view.
"The more that these Iran-backed militias help Iran, and the more they attack Saudi Arabia in particular, the more the Trump administration will get focused on them again, so they may well decide it's better to lay low for a while."
Mission accomplished?
Operation Inherent Resolve started in August 2014, when the US launched air strikes against ISIS targets in Iraq as the militants swept across Syria and northern Iraq.
Dozens of countries ended up contributing to the campaign, which marked America's return to Iraq after the troop withdrawal of 2011 under then-president Barack Obama. Allied troops and air forces went on to support Iraqi and Kurdish forces, and later Syrian partner forces.

According to the Pentagon, 123 US troops were killed during the mission and another 499 were wounded. More than 80,000 ISIS members were killed, according to a coalition estimate.
But a lack of US intelligence, logistical support and drones will give ISIS a chance to regroup, Kurdish commander Sirwan Barzani said, according to Reuters.
"For more than two weeks, we have noticed movement by [ISIS] sleeper cells, after it was announced in the general media that there will be an official withdrawal of the international coalition from Iraq by the end of September," he said. "This has boosted, in my opinion, the morale" of the fighters.


