The U.S. military prison known as Bagram, a hated symbol of U.S. interference in Afghan affairs, was officially transferred to Afghan control Monday.

The long-demanded handoff of Parwan detention center, the facility’s official name, occurred amid tensions between Washington and Kabul over the Afghan army’s ability to guarantee security at the prison and the court system’s preparedness to competently adjudicate detainee cases.

Pledges of mutual cooperation masked a behind-the-scenes dispute regarding about three dozen captives whom the United States has refused to release. The U.S.-led military coalition also held back the transfer of more than 600 more recently captured prisoners, but officials said that process would begin next week.

Even some Afghan officials fear that courts will end up releasing dangerous captives from the prison, because judges here often do not accept evidence gathered from intelligence sources. The United States has held some suspected militants for years on the basis of classified, undisclosed evidence, drawing international criticism. Allegations of abuse of detainees at the prison have stoked anti-American feeling here.

At Monday’s midmorning ceremony, the Afghan army formally took custody of hundreds of inmates accused of fighting for or supporting the Taliban and other Islamist militants battling Afghan and NATO forces during the 11-year-old war.

The handover marked a victory for President Hamid Karzai, fulfilling an agreement he struck six months ago with the United States. Karzai did not attend the ceremony at Bagram air base, 30 miles from Kabul, but he dispatched top generals and ministers to talk glowingly of the transition.

“It is a matter of great happiness and pride that a major step is being taken for the restoration of Afghanistan’s national sovereignty, the rule of law and justice,” Justice Minister Habibullah Ghalib said.

Gen. Sher Mohammad Karimi, the country’s top military commander, also sat in the reviewing stand, overlooking hundreds of assembled troops standing at rigid attention. Afterward, he expressed confidence that his army has the capacity to operate and secure Parwan. “We may have some challenges, but gradually, we will overcome the challenges,” Karimi said.

The prison handover is part of a larger transitioning of security responsibilities to Afghan forces — the linchpin of the U.S. plan to pull out its combat troops at the end of 2014.

The ceremony included the hoisting of Afghanistan’s flag and exclamations of “God is great” by the Afghan troops. The Karzai government provided helicopter transport to more than 50 local and foreign journalists to chronicle the event.

No high-ranking U.S. military officers or senior officials attended the ceremony. Army Col. Robert M. Taradash, who has overseen the prison, represented coalition forces. He said the United States had fulfilled its side of the March 9 agreement with Karzai.

At one point, Parwan held more than 3,000 inmates, but hundreds have been transferred to other facilities or released. “There were prisoners released who promptly joined the Taliban,” said one Afghan official familiar with the process, speaking on the condition of anonymity because his account contradicted those of the government.

The United States also will retain custody of nearly 50 foreign nationals at Parwan — many of them Pakistanis accused of fighting for the Taliban. “We are not interested in them,” said Zahir Azimi, an Afghan Defense Ministry spokesman.

The U.S.-led military coalition, in a statement Sunday night, alluded to concerns about transferring some of the high-value detainees to Afghan custody but did not give specifics.

“Some 99 percent of the detainees captured before 9 March have already been transferred to Afghan authority, but we have paused the transfer of the remaining detainees until our concerns are met,” said Jamie Graybeal, a coalition spokesman.

“That’s something that’s being resolved between our two governments,” Taradash said after the ceremony. “The governments are working together, and we continue to partner with the Afghans at this facility.”

Many observers say the Taliban insurgency has regained its strength, despite upbeat assessments by U.S. commanders who say the movement has been curtailed. Not long after Monday’s ceremony, a suicide bomber targeted police in the northern city of Kunduz, killing 15 people, local officials said.

Taliban propaganda has exploited reports of harsh interrogation techniques, indefinite detention and inadequate legal process at Parwan to recruit followers and incite terrorist attacks.

An Oscar-winning documentary about Bagram, “Taxi to the Dark Side,” also increased the prison’s notoriety. The detention facility never became a household name in the United States, like the detention camp at Guantanamo Bay, Cuba, or Iraq’s Abu Ghraib prison. Among Afghans, however, Bagram became synonymous with long-term extrajudicial imprisonment and alleged torture. An Army investigation into the deaths of two detainees in 2002 uncovered evidence of prisoners being severely beaten and chained to the ceiling by their wrists.

“It should be closed altogether, but I think [the transfer] is a good step,” said Ghairat Baheer, an Afghan citizen and Islamic Party official who was detained as an alleged militant for six years, four of them at Bagram. He said the prison, when under the control of the United States, only created enemies.

“The Americans used to be very arrogant,” said Baheer, whose Hezb-i-Islami faction has been allied with some elements of the Taliban but also supports a negotiated peace with the Afghan government. “There were religious, cultural and language barriers.”

With the Afghan government in charge, he added, “I think the detainees will have a better chance of feeling at home.”

Sayed Salahuddin contributed to this report.