As recently as Thursday, Mr. Karzai, in a telephone call with the NATO secretary general, Anders Fogh Rasmussen, stressed his position on detention and night raids.

A statement released by the presidential palace after the telephone call stated that Mr. Karzai had emphasized that any agreement must “respect the Afghan national sovereignty — meaning no imprisonment of Afghans by foreign troops and the transfer of all prisons in foreign force authority and the end to the night operations by the foreign forces.”

Mr. Karzai’s insistence on the complete cessation of night raids is another difficulty for the Americans, who have long insisted that they are critical to keeping the insurgency under control. The Americans and Afghans have said publicly that an increasing number of night raids are being done primarily by Afghan forces, but that some are still under American control and will transition more slowly.

Who has the most to gain from a partnership agreement has shifted as talks have dragged on through all of the last year, with the United States decreasingly invested in a deal and the Afghans, in particular elders and political leaders, increasingly convinced that it is essential for the country’s stability.

“The case is that Afghans need it more than the Americans, but the Afghans want it on their terms,” said a Western official in Kabul, who has experience in the country. “The fact is that it would be helpful to the peace talks in some way to make it clear to the Taliban and others that the Americans are here to stay.”

The comments echo a fear expressed by many that if there is no agreement, the Taliban would simply wait out the NATO troop withdrawal and then return to Afghanistan from their havens across the border in Pakistan.

The tension in the talks come as both countries appear to be re-evaluating their relations.

The United States — facing constant criticism from Mr. Karzai, a fractured Afghan political landscape and the increased targeting of its soldiers — appears to be considering other options for bases in the region. And it has sought out alternative ways to confront Al Qaeda’s presence in the Afghan-Pakistani border areas, once a prime element of a long-term relationship.