Senior administration officials have begun drafting sanctions against Iraq after President Trump publicly threatened the country with economic penalties if it proceeded to expel U.S. troops, according to three people briefed on the planning.

The Treasury Department and White House will probably take a lead role if the sanctions are implemented, the officials said. Such a step would represent a highly unusual move against a foreign ally that the United States has spent almost two decades and hundreds of billions of dollars supporting.

The officials, who spoke on the condition of anonymity because they were discussing internal deliberations, emphasized talks were preliminary and no final decision has been made on whether to impose the sanctions.

One of the officials said the plan was to wait “at least a little while” on the sanctions decision to see whether Iraqi officials followed through on their threat to push U.S. troops out of the country.

Sanctions are a type of economic penalty that the White House can use to try to isolate and penalize a person, company or government. For example, the White House could impose sanctions in a way that prohibits American businesses from working with Iraqi businesses. Cutting people or companies off from the U.S. economy and financial sector can prove extremely punitive.

The discussions about possible sanctions are part of a spiraling White House scramble to deal with the aftermath of Trump’s decision to kill Iranian Maj. Gen. Qasem Soleimani last week. Trump has floated multiple scenarios, both in terms of a military response and an economic response, aimed at Iran and Iraq, depending on how they decide to react.

On Sunday, in response to the killing, Iraq’s parliament voted to expel American troops from the country.

Trump responded quickly by saying he could impose “very big sanctions” on Iraq. If American troops are forced out of Iraq, Trump said, “We will charge [Iraq] sanctions like they’ve never seen before, ever. It’ll make Iranian sanctions look somewhat tame.”

Trump added the sanctions would be imposed on Iraq “if there’s any hostility, that they do anything we think is inappropriate.”

He also demanded Iraq reimburse the United States billions of dollars for investments made in an air base there as a precursor for any troops leaving.

Trump’s public broadside against Iraq, and the private, internal planning about how to proceed, comes as tensions in the Middle East reach a fever pitch over the killing of Soleimani.

Broad confusion remains over how the United States will respond to those demands. Defense Secretary Mark T. Esper said on Monday that the United States has not decided to leave Iraq, after a letter surfaced in which the U.S. military said to Iraqi officials that U.S. forces would be relocating “to prepare for onward movement.”

Some experts say it would be difficult if not impossible to implement punitive sanctions against Iraq without inadvertently hurting American interests, given the extensive links between the two nations forged through 17 years of war.

Thousands of American troops have died fighting the war in Iraq, and the United States has spent about $1 trillion on that conflict.

“I’m astounded by what’s even being discussed,” said Peter Kucik, who served in the Treasury Department’s Office of Foreign Assets Control, which implements sanctions policy, under the Bush and Obama administrations. “You don’t typically use force against your allies. We are threatening to use extreme coercive policy tools against countries with whom we are allied.”

The president probably has legal footing to unilaterally impose the sanctions on Iraq, said Erich Ferrari, an attorney who specializes in U.S. sanctions law.

“But I think it sets a bad precedent,” Ferrari said. “At a minimum, it’s disrespectful to their sovereignty to say: ‘If you’re going to make us leave, we’ll impose harsh economic punishments on you.’ ”