AFGHAN PRESIDENT Hamid Karzai and the Obama administration are playing a dangerous game of brinkmanship, one that could lead to a strategic reverse for the United States and a catastrophe for Afghanistan.

Both sides are culpable: Mr. Karzai, choosing to ignore the overwhelming sentiment of the Afghan political elite, is balking at signing a security agreement that would allow for a small U.S. force to remain in the country after 2014; he says he won’t act until after a presidential election in April. The Obama administration unwisely responded by setting an unnecessary deadline of Dec. 31 for Mr. Karzai’s signature and declaring that, if it is not met, it will plan on withdrawing all forces after next year.

Both sides seem to be betting that the other is bluffing. But the stakes are much too high for a pointless game of political chicken. Mr. Karzai is risking the loss of not just a force of advisers and counterterrorism operators that could be crucial to preserving the Afghan army and government after next year but also billions of dollars in military and economic aid already pledged by Washington and its NATO allies. That’s why a 50-member assembly of leaders handpicked by Mr. Karzai voted overwhelmingly over the weekend to endorse a draft 10-year agreement between the United States and Afghanistan and urged Mr. Karzai to sign it within a month.

Though some U.S. officials claim that a stable Afghanistan is no longer a strategic interest, the United States also has much to lose: namely, the fragile gains purchased by a dozen years of hard fighting that have cost nearly 2,300 American lives. Those gains include an Afghan army that has taken over 99 percent of the fighting against the Taliban and held its own, as well as a nascent democratic political system that is headed toward a competitive presidential election to replace Mr. Karzai. No wonder NATO allies are quietly urging the White House not to throw away in a fit of pique the achievements of the most consequential operation in the alliance’s history.

Mr. Karzai’s shifting reasons for delaying his signature reflect pent-up resentment toward President Obama and his staff, who have mistreated the proud Afghan leader throughout the past five years. While U.S. officials have a right to be irritated by the Afghan president’s antics, their insistence that an accord can’t wait past the end of the year is unjustified. Military logicians already know they must withdraw more than 35,000 of the 50,000 U.S. troops in the country next year; experts say they can wait as late as next summer to learn whether the rest must also leave. Since the leading presidential candidates support the pact, the administration can afford to wait Mr. Karzai out, if necessary.

Instead, the Afghan’s irascibility is playing into the hands of White House political operatives who would like to withdraw all U.S. forces while assigning blame to the host government, as happened with Iraq in 2011. If that’s what happens, the consequences would be similar: an escalating civil war that destroys U.S. allies and empowers ­extremists.