Barack Obama ran for the presidency in 2008 saying that the war in Iraq was "bad," and that the "neglected" conflict in Afghanistan was the "good" war that needed to be fought. He reversed his predecessor's decision to do the minimum necessary in Afghanistan to keep it out of the hands of the Taliban and essentially doubled the U.S. forces there.

Now four years, hundreds of billions of dollars and more than 1,600 U.S. military deaths later, the "good" war has gone bad. Unless there is a new agreement with the government of Afghanistan, U.S. forces will have to leave in 10 months with their major mission - creating a viable Afghan security force - unfinished and the Taliban eagerly waiting in the wings.

Even with a new accord, it would likely take years and hundreds of billion of dollars more to leave Afghanistan a secure future.

Standing in the way of an agreement is Afghanistan's departing president, Hamid Karzai, who has clearly decided that he wants the Americans gone, even though last week he told the Times of India that he is "not against a limited presence."

Afghanistan will elect a successor to Mr. Karzai in April. The Washington Post reports that the White House will wait to negotiate a new troop presence with the next president, though that would severely limit the time available to U.S. military, diplomatic and foreign aid operations to adjust to any changes.

But Mr. Karzai appears to be trying to frustrate even that plan. He is trying to stir up the anti-American vote, which could include Taliban balloting. The New York Times has documented that Mr. Karzai's team has falsified evidence, accusing U.S. troops of systematically killing women and children.

And earlier this month, the Karzai government overrode strong U.S. protests by releasing 65 prisoners accused of participating in Taliban attacks.

In addition to his outreach to the Taliban, President Karzai appears to be making alliances with warlords who formerly divided Afghanistan into a series of fiefdoms and who have participated in attacks on Americans.

In January, one of Mr. Karzai's aides said that the Afghan leader believes the U.S. was behind a series of terrorist attacks in Kabul, a view characterized as "paranoid" by the American embassy in Kabul. Mr. Karzai's spokesman later denied the report, though the episode revealed just how strained the U.S.-Karzai relationship has become.

Meanwhile, a terrorist group known as Hezb-e-Islami claimed responsibility for an attack that killed two U.S. contractors this month. Mr. Karzai and his chief of staff are known to be close to Hezb-e-Islami and its leader, Gulbuddin Hekmatyar, a former warlord. One of the 11 candidates running for president in April, Qutbuddin Hilal, is a Hezb-e-Islami member.

Back in 2009, President Obama announced that American combat forces would leave Afghanistan in 2014, resisting military advice that their withdrawal be conditioned by facts on the ground.

In fairness, though, despite Mr. Obama's previous assertions about the "good" war in Afghanistan, the patience of the American public is rightly limited more than 12 years into the U.S. military mission there.

And as the reduction of American ranks continues, so presumably does any realistic chance of a positive outcome in Afghanistan.

Indeed, our forces must be ever alert not just for attacks by the Taliban, but for potential treachery by our ally Mr. Karzai and his associates.

After all, the Afghans have a tradition of speeding the departing guest's exit.