The lead American negotiator in talks over a long-term security agreement with Afghanistan has privately warned the Obama administration that its efforts to persuade President Hamid Karzai to sign the document on the U.S. timetable are likely to fail, according to officials.

The assessment, if borne out, could raise the chances of a hasty and messy troop withdrawal by the end of the year and would leave the administration with little time to assemble a military coalition to remain in Afghanistan after the pullout.

The assessment, transmitted in recent days in a classified cable by U.S. Ambassador James B. Cunningham, follows the administration’s repeated extension of the deadline for an agreement it originally said it expected to complete early last fall. The White House said this week that the document must be signed within “weeks, not months.”

In the cable, Cunningham said he did not think Karzai would agree to sign the pact before a presidential election scheduled for April.

The ambassador’s conclusion is a stark indication of how acrimonious discussions between the two countries have become. On Thursday, in a separate blow to relations, Karzai’s government said it will release 72 high-profile Afghan detainees, turned over by the U.S. military for trial, despite American insistence that they pose a threat to Afghan and U.S. security forces.

The decision, flying in the face of a 12-year-old U.S. effort to bolster the Afghan legal system, was made by Karzai and a panel

of senior officials, presidential spokesman Aimal Faizi said. Evidence had been provided by the Afghan intelligence service and the U.S. military, but Faizi said that “the Americans didn’t have any proof.”

After a year of testy negotiations, the U.S. inability to complete the security accord could open the administration to charges of “losing” Afghanistan if all U.S. troops have to leave. Senior Republican lawmakers, including House Speaker John A. Boehner (Ohio), charged Thursday that President Obama was largely responsible for the ongoing upheaval and al-Qaeda gains in Iraq, where the administration was unable to complete a similar agreement before the final departure of American troops from that country at the end of 2011.

In an assessment circulated last month, the U.S. intelligence community judged that a total American military withdrawal from Afghanistan would lead to a rapid collapse of central government control to the Taliban and other power brokers in wide swaths of the country.

Asked about Cunningham’s assessment, a senior State Department official said, “We cannot comment on alleged classified documents.” But the official said, “We continue to urge President Karzai to sign the BSA promptly,” referring to the bilateral security agreement. Civilian officials’ appraisals of the political and diplomatic situation in Afghanistan have sometimes been more negative than those of the U.S. military.

U.S. officials who spoke about the cable did so on the condition of anonymity because they were not authorized to discuss it.

The troop agreement would allow U.S. military trainers and counterterrorism forces to remain in Afghanistan after the last American combat troops leave the country by Dec. 31. The State Department considers a residual U.S. military presence crucial to its plans to maintain a major embassy in Kabul, at least three consulates across the country and ongoing development projects worth billions of dollars.

That force could be made up of an estimated 8,000 to 10,000 troops, although Obama has not decided on its size.

If the Americans revert to a “zero option,” NATO and other partners that have agreed to leave smaller troop contingents in Afghanistan have said they would pull out, and about $8 billion in annual security and economic aid to begin next year would probably disappear.

Although Pentagon officials said they have not received formal orders to start planning for a complete withdrawal, White House spokesman Jay Carney said this week that “we’re talking about weeks and not months” for concluding the agreement and that “the clock is ticking.”

“If we cannot conclude a bilateral security agreement promptly,” Carney said, “then we will be forced to initiate planning for a post-2014 future in which there would be no U.S. nor NATO troop presence in Afghanistan. That’s not the future we’re seeking. . . . But the further this slips into 2014, the more likely that outcome will come to pass.”

As negotiations continued last year, U.S. officials repeatedly said they did not want a repeat of the Iraq experience — in which talks over a long-term security presence continued almost to the day the last U.S. combat troops left. Among the most contentious issues was Karzai’s insistence that all Afghan prisoners being held by U.S. forces there be turned over to his government; the dispute was settled last spring.

Final hiccups were said to have been resolved after Secretary of State John F. Kerry made an emergency trip to Afghanistan in early October during which he held intensive talks with Karzai. But a signing expected by the end of that month was postponed after the Afghan president said he wanted to submit the issue in November to a body of tribal leaders he had appointed to debate the merits of the accord.

The panel strongly endorsed the pact, but Karzai stunned U.S. officials by making a new series of demands and suggesting that the agreement could be signed after his successor was elected. Beyond the need for an early decision to facilitate planning, U.S. officials are concerned that the issue will once again become politicized as presidential contenders campaign and a new government seeks to put its own stamp on security arrangements.

Among his new demands, which include the release of Afghans detained at Guantanamo Bay, Cuba, Karzai appears particularly seized with one: that Washington persuade the Taliban leadership to engage in peace talks with his government.

“We want the BSA, but the Afghan people have their conditions,” said Faizi, the presidential spokesman. “The ball is in the United States’ court.”

Faizi said the release of Guantanamo detainees, a proposal that has gained little traction in Washington, could bring the Taliban to the negotiating table. “We need visible signs,” he said. “We don’t want more empty promises.”

U.S. officials have said that they support peace talks between Kabul and the Taliban but have dismissed as absurd the notion that they can facilitate such an outcome.

Taliban leaders, who oppose a continued U.S. military presence in Afghanistan, say the string of attacks they have carried out this winter — a time when violence levels normally drop in Afghanistan — demonstrates that their movement remains strong and determined to expel foreign forces.

Of the 3,000 prisoners turned over to the Afghan government in March, about 560 have been released without trial.

During a visit to Kabul last week, Sen. Lindsey O. Graham (R-S.C.) said the release of the 72 prisoners “would have an unbelievably negative impact” on U.S.-Afghan relations and would prompt “a backlash in the U.S. Congress.”

After the presidential palace announcement, Col. David Lapan, a spokesman for the U.S.-led International Security Assistance Force (ISAF) in Afghanistan, said their release “undermines Afghan rule of law, because the Afghan people do not get their day in court.” The 72 are part of a group of 88 who U.S. officials say collectively killed 60 members of the coalition. The 16 others were bound over for trial.

The release was announced just as news of the war’s most recent civilian casualty began to circulate. A 4-year-old boy was fatally shot by U.S. Marines in an operation in southern Helmand province, said Omar Zowak, a spokesman for the provincial government. The ISAF acknowledged the casualty but declined to give details.

Sieff reported from Kabul.