Afghan President Hamid Karzai, center, arrives to attend the Loya Jirga, a traditional forum dealing with significant decisions affecting the whole country, in Kabul, Afghanistan, on Nov. 21. (S. SABAWOON/EPA)

The year-long quest for an agreement for U.S. troops to remain in Afghanistan beyond 2014 took a potentially ominous turn Thursday as President Hamid Karzai told a national assembly called to consider the deal that he won’t sign it until after the presidential election here in April.

Karzai’s comments, in remarks opening the gathering of more than 2,500 tribal elders, civil leaders and officials, surprised delegates and left U.S. officials in Kabul and Washington in the familiar position of trying to figure out exactly what he said and what he meant.

At the end of the day, after translating Karzai’s speech and consulting with his aides, U.S. officials said that if the Afghan leader did not sign the deal by the end of the year — a timeline they said the Karzai administration had agreed to — President Obama might have no option but to cancel any remaining U.S. military presence after next year’s withdrawal of combat troops.

The officials said they expected “clarity” in Karzai’s position over the several-day assembly, called a loya jirga.

“We need a timely conclusion of this in order to plan any potential post-2014 presence,” said Jen Psaki, a spokeswoman for the State Department, “which means signing it by the end of the year.”

President Obama is prepared to decide on and announce the size of a post-2014 U.S. military training and counterterrorism force within weeks, once the document is signed, according to administration officials who spoke on the condition of anonymity about the increasingly tense diplomatic situation.

But any delay past December, the officials said, endangers the United States’ planning, as well as that of NATO and other partners that have said they will leave residual troops. An April signing, the officials said, was completely unacceptable.

Defense Secretary Chuck Hagel said that “until we have a signed bilateral security agreement that essentially gives us then the assurance that we need to go forward, I don’t think the president is going to commit to anything. He’s said that. And my advice to him would be to not.” Hagel spoke to reporters en route to a defense conference in Halifax, Nova Scotia.

Without the security agreement governing a continuing troop presence, future international funding for Afghanistan would be at risk. By saying that Karzai’s comments were “unclear,” while threatening to walk away from the agreement, the administration appeared to be giving him the opportunity to revise or withdraw his remarks.

Karzai spoke a day after Secretary of State John F. Kerry announced that the accord’s language had been finalized and the Afghan government published the accord online.

According to what U.S. officials said was the agreed timeline, Karzai and Obama would sign the document once the nonbinding assembly had considered it, and Obama would proceed with planning for a U.S. force that most estimates have said will number between 5,000 and 10,000. Karzai said Thursday that the force could reach 15,000.

But in his speech, Karzai said debate over the agreement — which must be approved by the Afghan parliament — should last for months, to ensure that the country’s political leaders are comfortable with thousands of U.S. troops remaining beyond 2014.

“This agreement will be signed when we hold honorable and proper elections,” he said, referring to the April 5 election in which voters will choose his successor.

Karzai’s comments clearly shocked some assembly delegates. If the signing is delayed, supporters of the deal fear that it will give hard-line Islamic activists crucial time to derail it. And with 11 candidates seeking the presidency next year, he appeared to be tossing the question of continued U.S. presence into the unpredictable realm of Afghan politics.

“It is better and in our interest to sign it now, because there is no guarantee that the next government will be as legitimate as the current one,” said Sharifullah Kamawal, a delegate from Nangahar province.

Karzai had raised doubts about the accord at several points since negotiations began last November, only to back down after talks with U.S. officials.

Several times, the administration hinted that it was prepared for the “zero option” of complete withdrawal, similar to the U.S. pullout from Iraq in 2011.

The draft was finally agreed upon early Thursday, after Obama wrote a letter assuring Karzai that U.S. forces would continue to respect the “sanctity and dignity of the Afghan people.”

Despite his comments on the timing of his signature, Karzai told the loya jirga that he supported the deal and urged delegates, meeting in a tent that resembled an inflatable sports stadium, to consider the consequences of a full U.S. withdrawal.

“If the U.S. won’t stay here, the Germans, Britain, France, all of NATO and some Islamic countries also won’t stay here,” he said. “The [agreement] will support us financially, train our forces and strengthen them.”

Although the assembly’s approval is not required, Karzai told the delegates that he would not send the document to parliament if they did not approve it. “It is your decision,” he said.

Under the agreement, the United States can maintain up to nine bases in Afghanistan, and U.S. troops and Defense Department civilians working with them will be able to enter Afghanistan without having to obtain visas.

The residual U.S. force is barred from engaging in “combat operations” except in “mutually agreed” circumstances, including possible support if there are attacks on Afghan forces.

The agreement allows an indefinite U.S. presence, but Karzai said Thursday that it would be in place for 10 years. U.S. officials said it would be much shorter than that but did not specify a time limit.

The United States prevailed over the sensitive issue of whether U.S. troops should be subject to American or Afghan legal jurisdiction in the event of possible wrongdoing. Separately, a compromise was reached allowing U.S. troops to enter Afghan homes only under “extraordinary” circumstances.

At several points during Karzai’s hour-long address, delegates interrupted with opposition to parts of the deal. One woman shouted that she would not agree to give U.S. forces immunity from local laws, saying they must be held accountable for the deaths of Afghan civilians.

Karzai told the delegates that many countries had urged him to sign the agreement; only Iran had voiced opposition, he said. He also lamented that the United States has placed limits on the types of weapons it plans to supply to Afghanistan.

“I demand tanks from them, and they give us pickup trucks, which I can get myself from Japan,” Karzai said. “I demand fighter jets, and they give us” small transport planes.

Later in the speech, he bluntly stated: “I don’t trust the U.S., and the U.S. doesn’t trust me.” Still, he added, the delegates should approve the agreement for the “happiness of today’s and future generations.”

DeYoung reported from Washington. Mohammad Sharif and Sayed Salahuddin in Kabul and Ernesto Londoño in West Point, N.Y., contributed to this report.