Afghanistan's flag is seen, top right, as Afghan soldiers stand attention during a hand over ceremony of U.S.- run prison to Afghan government in Bagram north of Kabul, Afghanistan, Monday, Sept. 10, 2012. U.S. officials handed over formal control of Afghanistan's only large-scale U.S.-run prison to Kabul on Monday, even as disagreements between the two countries over the thousands of Taliban and terror suspects held there marred the transfer.

KABUL, Afghanistan — Afghan officials on Monday accused their American counterparts of reneging on parts of an agreement that saw the U.S. military formally hand over its main prison in this country to Afghan control.

The dispute bodes ill for relations between the two sides in the coming year, when much of the responsibility for running the decade-old war is to be turned over to the Afghans in advance of the end of NATO’s combat role. President Hamid Karzai’s government has been increasingly strident in asserting Afghan sovereignty even when U.S. or NATO officials have qualms about whether Afghans are up to a given task.

Authority over most of the estimated 3,000 prisoners at the Parwan Detention Facility, located at the sprawling Bagram air base north of the capital, had already been handed over to Afghan officials before Monday’s official transfer.

But the Americans have concerns that suspected members of the Taliban and other insurgent groups may either be released without proper scrutiny or subjected to torture. The Afghans in turn say Americans routinely hold suspects for long periods of time without charging them.

Adding to the overall air of acrimony, the detention center earlier this year was the scene of one of the year’s most damaging episodes for U.S.-Afghan relations: the burning by U.S. troops of copies of the Quran, which set off days of lethal riots. Those involved were subjected to military discipline, but many Afghans believe that the administrative punishments were not nearly severe enough.

Karzai’s government staged an elaborate handover ceremony Monday morning at Bagram, even while warning that the United States would be in breach of a memorandum of understanding signed six months ago if not all of the prisoners were turned over. The United States has retained custody of about 35 detainees, many of them insurgent suspects, together with a few dozen non-Afghan nationals.

“Under Afghan law, foreigners are not allowed to have even one detainee; all the detainees need to be handed over to the Afghan side,” said Gen. Mohammad Zahir Azimy, a spokesman for Afghanistan’s Defense Ministry.

Karzai and U.S. Marine Gen. John Allen, who commands the NATO force, reportedly had an angry dispute over the transfer issue during a weekend meeting. A spokesman for the Western military, German Brig. Gen. Gunter Katz, on Monday characterized it as a private exchange “between partners.”

The dispute comes on the eve of the anniversary of the 9/11 attacks, which on Monday brought a bellicose statement from the Taliban accusing the United States of using the “September incident” as a pretext for an unjust war in Afghanistan.

After nearly 11 years of war, the movement declared that the “criminal warmongers” — the United States and its allies in the NATO force — were “fleeing the battleground, one after the other.”

“America … is facing utter defeat in Afghanistan militarily, politically, economically and in all other facets, and it has exhausted all other means through which to prolong its illegal war,” it added.

The statement comes at a time of discord within the Taliban movement over whether to move toward negotiations with the United States or to wait until after 2014, by which time most NATO troops are scheduled to have gone home. The Taliban leadership has publicly spurned the notion of talks with the Karzai government.

While taking a typically bombastic tone, the movement also appeared to be inching closer to acceding to one of the demands of the West and the Karzai administration: that the Taliban renounce ties to al-Qaida and other terror groups based outside Afghanistan. The Taliban sheltered Osama bin Laden and his lieutenants before and after the 9/11 attacks, until the U.S.-led invasion in October 2001 drove the movement from power.

Though the Taliban and al-Qaida remain nominal allies, their goals had diverged even before the death of Bin Laden in a U.S. raid last year.

“We are neither a threat to anyone, nor will we let our soil be used to harm anyone,” said the statement, which was issued in the name of Zabiullah Mujahid, a name used by various Taliban spokesmen.

