They must be uncorking the non-alcoholic champagne in Teheran today.

The Obama administration’s decision to withdraw by 2011 all but 160 U.S. active-duty troops to guard the American embassy in Baghdad is a strategic defeat for the U.S. that is likely to significantly enhance Iran’s already considerable influence in Iraq and throughout the region.

But let’s remember this: this was clearly Iraq’s call. For the past several months, administration officials have been quietly pressing Baghdad to negotiate a new agreement that would enable Washington to keep several thousand U.S. troops there to continue efforts to help stabilize the country and train Iraqi security forces. Specifically, American negotiators have insisted that Iraq grant American forces in Iraq immunity from prosecution in Iraqi courts as a condition of extending America’s military presence there.

But Iraqi Prime Minister Nouri al-Maliki, who heads a politically fractious coalition that is in thrall to the Iran’s ruling mullahs, has been unable or unwilling to do so. And the Obama administration has been unwilling to stay without such immunity guarantees. So the U.S. really has little choice but to abandon initial plans to leave 3,000 to 5,000 American forces in the country after Dec. 31, to help guarantee stability and help Baghdad defeat remnants of Al Qaeda and other Islamist militants.

Iraqi officials tell me that while Maliki wanted several thousand of the some 40,000 troops now based in Iraq to remain longer than the deadline and personally favored granting such immunity, Muqtada al-Sadr, a virulently anti-American cleric who lives partly in Iran, and other Islamist members of Maliki’s coalition not only threatened violence, but also to desert the coalition and bring his government down if the American forces stayed.

So this decision, in effect, was made in Teheran. And make no mistake about it: the decision is bad for the prospects of stability in and the political independence of Iraq, bad for the United States, which is likely to be accused of abandoning its eight-year commitment to the security and stability of the country it invaded and upended in 2003, and good for Iran, which will be seen as having forced Washington to abandon its military commitment to Iraqi stability.

While many will praise President Obama’s decision to withdraw virtually all American active-duty forces there – thousands of security contractors and diplomats will remain in Iraq, after all -- the administration’s critics are likely to charge -- particularly in a politically charged election season -- that he left Iraq before stability was assured, and hence, if chaos increases and Iranian influence grows, that the 4,400 American soldiers killed during the 8 year war in Iraq died in vain. This is particularly a risk given the timing of the leak of the withdrawal plans.

Earlier this week, the Obama administration accused Iran of trying to assassinate Saudi Arabia’s ambassador to the U.S. and blow up the Israeli and other embassies in Washington. Such an Iranian-blessed plot, if proven, would suggest that Iran has become far more aggressive and willing to take unprecedented risks to achieve its political goals. Such terrorism on American soil, had it succeeded, might well be considered an act of war.

President Obama has made no secret of his view that the Iraq invasion was an ill-conceived “war of choice” that diverted American attention from fighting Al Qaeda, the Taliban and other militant Islamist allies in Afghanistan. And he had long vowed to withdraw most of the active-duty forces from Iraq by the year’s end, saying that America’s investment there in blood and treasure had continued long enough. But he did try to negotiate an agreement with Maliki. His inability to do so may leave his administration open to charges that it did not try early enough or hard enough to persuade Iraq that a sustained American military training presence in the country was in Iraq’s best interests.

Judith Miller is a Pulitzer Prize winning writer, author and Fox News contributor.