In the 1980s, the Soviet Union learned that it's much easier to invade Afghanistan than to leave on your own terms. And nearly 25 years after the Russians left the country defeated, the U.S. is learning the same lesson under very different circumstances.

The 12-year-old, NATO-led war in Afghanistan will officially end in late 2014, but the U.S. has negotiated a bilateral security agreement that will allow it to keep 10,000 troops in the country for another decade.

Afghan President Hamid Karzai says he won't sign it.

The U.S. has put a deadline of Dec. 31 on the agreement. On Sunday, at the conclusion of a loya jirga, or grand assembly of tribal leaders that Karzai had convened to weigh in on the pact, the president announced that he wanted to reopen negotiations and wouldn't sign the BSA until "we are sure we are on the path of peace and Afghanistan has a new president." Voters will select the term-limited Karzai's successor on April 5, 2014.

The loya jirga endorsed the U.S. agreement and approved a resolution urging Karzai to sign it by the end of the year. The jirga's organizer, longtime Karzai ally Sibghatullah Mujadidi, even announced at the end of the gathering that if Karzai didn't sign the pact in three days, "I will resign all my positions and seek refuge in another country."

In fact, with the exception of Iran, Pakistan, and the Taliban, everybody seems to want Karzai to sign the U.S. security agreement, stat.

"China, India, Russia, and the Central Asian countries, as well as Turkey, Saudi Arabia, and the United Arab Emirates — all of whom either face or fear Islamic militancy, seem to be in favor of this deal," says the BBC's Dawood Azami. None of them want a permanent U.S. military presence, "but they have accepted the short-term presence of U.S. forces in Afghanistan as a 'lesser evil,' hoping it will work as a stabilizing force that could keep militancy confined within Afghan borders."

So why is Karzai opposed to signing the agreement in the next month? Nobody's quite sure. But lots of people have theories.

On Sunday, Karzai himself seemed to tie his reluctance to concerns about U.S. searches of Afghan homes. "If Americans raid a house again, then this agreement will not be signed," he told the loya jirga, with U.S. Ambassador James Cunningham in attendance. The draft agreement allows U.S. forces to enter Afghan homes "in extraordinary circumstances when the life or limb of Americans is at stake."

That doesn't go far enough, Karzai suggested. "From this moment on, America's searching of houses, blocking of roads and streets, military operations are over, and our people are free in their country." The Afghan president is particularly upset about a November 19 night raid in which twin brothers in a Nangarhar Province town were killed either by a joint raid led by Afghan security forces, as the U.S. claims, or a unilateral U.S. strike, as Afghan officials claim.

Unlike other "U.S. dictator allies," Karzai has been "defiant, and critical of U.S.-led military operations resulting in civilian casualties and disrupted life for the Afghans," says Deepak Tripathi at Al Jazeera. You can't understand this dynamic, or his mercurial relationship with the U.S., unless you consider the "important narrative" in Kabul that Obama and his administration have "caused deliberate and repeated humiliations of Afghanistan and President Karzai."

Karzai was part of the anti-Communist Afghan opposition in the 1980s. He is well aware of the failed Soviet attempts to use loyal rulers to lead Communist regimes in Kabul. It was a somewhat risky move for the White House to publicly set a deadline barely a month away, at a time when the loya jirga was meeting.... In a distrustful relationship, Karzai's interest is in securing maximum cover for himself in the eyes of his people; true national sovereignty; and freedom for the next Afghan president to act. In essence, a legacy which, Karzai can argue, was delivered at a time of extreme national emergency. [Al Jazeera]

Karzai could also just be trying to spook the U.S. into negotiating a better deal. But that's "a high-stakes gamble," and his hand isn't as good as he thinks, says Rod Nordland at The New York Times. Karzai seems to be under the impression that the U.S. needs this agreement at any cost, an unidentified diplomat tells Nordland, but "the Americans internally are very clear: That it's not a vital strategic interest, and he doesn't get that."

U.S. officials are implicitly threatening to leave Afghanistan entirely, as they did Iraq when similar negotiations over a postwar security agreement broke down. "I think Karzai can very easily miscalculate," a Western official tells The New York Times. "Likewise, the U.S. could too, and so there is uncertainty all around. Emotions are running high, and we need to try and not be as emotional as Karzai during this critical time."

Karzai doesn't trust the U.S., fears that the Americans will meddle in Afghan affairs, and is "concerned about his legacy," says the BBC's Azami. "He is asking for guarantees so as not to appear responsible for an agreement that might be seen in the future as selling out to foreign interests." But he may not mind the pressure on him to quickly sign the U.S. agreement as is.

Karzai might well "be hoping that the jirga's decision will result in a last-minute change of heart by the Taliban to stop fighting and join the political process," Azami says. The Taliban was "apparently hoping to have a free ride" after NATO forces decamped by 2015. "This agreement will prove them wrong," and that can be a useful negotiating tactic.