In the wake of the U.S. killing of Iranian Gen. Qassem Soleimani, Iraq says it wants Americans gone once and for all. In a conversation with Secretary of State Mike Pompeo on Friday, Iraqi Prime Minister Adel Abdul Mahdi asked the U.S. to send a delegation to set up a mechanism for withdrawing U.S. troops from his country. This came after a confusing and violent week in which the Iraqi Parliament voted to demand the withdrawal of U.S. forces, the U.S. sent and then disavowed a letter agreeing to do so, and Iran launched a missile strike against bases hosting U.S. troops.

The U.S. response to Mahdi’s demand has been more or less “No.” A State Department statement on Friday, after beginning dramatically, “America is a force for good in the Middle East,” made clear that any future negotiations would be “dedicated to discussing how to best recommit to our strategic partnership—not to discuss troop withdrawal.”

If neither side backs down, we’re facing a situation where U.S. troops remain in Iraq without the Iraqi government’s permission. That’s unknown territory for the U.S.-Iraq relationship, and it could be interpreted as an act of aggression under international law.

The principle of seeking a country’s permission to keep troops in its territory is about as fundamental as you get in international law. U.S. troops are deployed in dozens of countries around the world, generally under Status of Forces Agreements with the host countries that define the legal framework for their operations.

In Iraq, U.S. forces were authorized by a United Nations mandate from 2003—shortly after the invasion—until 2008, when the George W. Bush administration agreed to a formal Status of Forces Agreement with then–Iraqi Prime Minister Nouri al-Maliki. That agreement expired in 2011. Barack Obama’s administration tried to renegotiate the agreement with Maliki to allow for a continued U.S. troop presence, but hit an impasse over whether the Iraqi Parliament would grant those troops immunity from prosecution under international law. The last U.S. service members left Iraq at the end of 2011, but they returned in 2014 to fight ISIS at Maliki’s invitation —at a time when Iraq’s own military forces were collapsing. There was no formal agreement this time, but Maliki’s successor, Haider al-Abadi, provided assurances that U.S. troops would enjoy immunity.

The Iraqi constitutional issues may be a bit murky, but it’s clear that U.S. troops were in Iraq at the prime minister’s invitation and that that invitation has now been—or at least will very soon be—rescinded.

The closest parallel to what might happen if U.S. forces just stay without permission might be the current situation in Syria, where the U.S. is fighting ISIS without the permission of the Bashar al-Assad regime. But in that case, it’s operating in areas outside the government’s control and with the cooperation of the local de facto authorities, the Syrian Kurds. That’s a tougher argument to make in Iraq.

Oona Hathaway, a professor of international law at Yale and former State Department legal adviser, writes in an email that the U.S. would “almost certainly” be violating international law if it insists on staying in Iraq despite Iraq’s wishes. She points to Article II of the U.N. Charter, which forbids countries from “use of force against the territorial integrity or political independence of any state.”

“It’s also arguably a declaration of war,” Hathaway said.

We’re not quite there yet. U.S. troops in Iraq are mainly operating on Iraqi bases, training Iraqi forces. So if Mahdi is serious, he would need to evict those troops and cancel that training. There’s reason to believe he may back down, given who swooped in after their last departure in 2011. Scott Anderson, a former State Department legal adviser now at the Brookings Institution, says it’s likely that both sides are signaling to their domestic audiences. He believes that an agreement will still be worked out that “the Iraqis will frame as slow withdrawal, and the Americans will frame as repositioning.”

Still, it’s clear that the Soleimani strike has enormously complicated the future status of U.S. forces in the country and their mission to fight ISIS. The Trump administration is going to have to clean up this mess in a hurry unless it wants to either abandon that mission or effectively reinvade Iraq.