Updated

A senior Afghan official predicted Friday that the United States and Afghanistan will soon sign a broad deal for U.S. use of Afghan soil for counter-terrorism missions and U.S. obligations to the fledgling democracy it has sponsored since toppling the Taliban regime in Afghanistan weeks after the terror attacks of Sept. 11, 2001.

The two nations remain divided over terms for their relationship after most U.S. forces leave the country following two days of negotiation over a framework for long-term U.S. military and economic support for the country.

Afghan national security adviser and former Afghan foreign minister Rangin Dadfar Spanta said two days of talks closed some gaps over sticking points such as who will control detention of suspected militants and leadership of counterterrorism raids that Afghans generally despise as intrusive and indiscriminate.

He told The Associated Press the overarching goal of the agreement is to establish Afghan sovereignty over its national security and external affairs, a position potentially at odds with U.S. contingency plans to pursue terrorists or militants who threaten the United States.

"Afghanistan will never allow the use of Afghan soil against Afghanistan's neighbors or other third countries," Spanta said after the close of talks Friday evening.

A U.S. military official said large gaps remain over enforceability of the eventual pact, which the U.S. has insisted will not hold the legally binding force of a treaty. Instead, it will be a statement, presumably signed by President Barack Obama and Afghan President Hamid Karzai, that stops short of a treaty.

The U.S. official, speaking on condition of anonymity to describe ongoing negotiations, said Afghanistan is also seeking assurances of guaranteed U.S. military and development spending in that country, something U.S. negotiators have said is impossible to quantify in a time of huge deficits and budget constraints. Divisions over who has authority over detentions and so-called counterterrorism "'night raids" are likely to be papered over in the final agreement, two U.S. officials said.

Spanta led an Afghan delegation that concluded two days of negotiations over a pact that will govern U.S. military activity and economic and other commitment to Afghanistan after the formal U.S. combat role in the country ends in 2014. The U.S., NATO and Afghanistan agreed last year that combat forces would leave by the end of 2014, and that Afghan forces would take over. Afghanistan is seeking the pact, but two previous rounds of talks have dragged on longer than U.S. officials wanted.

"I am leaving extremely satisfied," Spanta said, following talks with Secretary of State Hillary Rodham Clinton, Defense Secretary Leon Panetta, Joint Chiefs of Staff Chairman Adm. Mike Mullen and lower-level officials at the White House.

Spanta said the goal is to have a deal ready before an international conference on Afghanistan's future in December, but that there is no set deadline. Afghanistan plans to submit the deal to its parliament and probably to an informal council of elders known as a loya jirga that would lend legitimacy across the country's disparate ethnic and tribal factions. U.S. officials have said there are no plans to submit the pact to Congress, since it will not be a treaty requiring Senate confirmation.

For the United States, the chief goal of the agreement is to reassure Afghanistan that the U.S. will not turn its back on Afghanistan once the bulk of combat forces leave, while framing terms for the continuing hunt for al-Qaida and other militants who may use Afghanistan as home turf.

The agreement, now in draft form, would give the U.S. use of Afghan-run or jointly run bases after 2014. U.S. officials stress that U.S. military presence will be at Afghanistan's invitation. A State Department notice about the talks said the U.S. would respect Afghan sovereignty and noted that there were no plans for permanent American military bases in Afghanistan or "a presence that would be a threat to any of Afghanistan's neighbors."