The US has formally handed over the controversial Bagram prison to the Afghan government.
The move has resulted in the transfer of more than 3,000 detainees to Afghan control at the prison, which has been dubbed the country's "Guantanamo Bay".
Anders Fogh Rasmussen, NATO Secretary-General, told Al Jazeera the decision was part of a deal to transfer all prisons to Afghan control before the withdrawal of NATO forces at the end of 2014.
"This is a handover based on a bilateral agreememt between the Afghan government and the United States," he said.
"I think this agreement strikes the right balance between transition to Afghan responsibility and security - we have to make sure that security concerns are taken into consideration, and that's also in the Afghans' interest."
The Afghan government has hailed the transfer of Bagram prison as a victory for sovereignty.
Analysts, however, said that the decision was more symbolic than substantial and human rights advocates had raised concerns about abuses of administrative detention.
Questions remain over the fate of the inmates, who include Taliban fighters and terror suspects, 50 foreigners not covered by the agreement, and hundreds of Afghans arrested since the transfer deal was signed on March 9.
Afghan officials organised and presided over a small handover ceremony on Monday at the prison, officially called the Parwan Detention Facility but more commonly referred to as "Bagram" after the neighbouring US airbase north of Kabul.
Attendance among US and NATO officers was low as the Afghan flag was erected over the prison, marking the transfer.
"We transfer more than 3,000 Afghan detainees into your custody," said Colonel Robert Taradash, the outgoing commander of Parwan and the highest ranking US official at the ceremony.
He also gave an assurance that "those who threaten the partnership of Afghanistan and coalition forces will not return to the battlefield".
|From the perspective of one neighbourhood in Herat
Safiullah Safi, an Afghan military police commander, said that 3,182 prisoners had been formally handed over, following a six-month transition.
"I'm happy that today we are witnessing a glorious ceremony that marks the handing over of responsibilities of Afghan prisoners to Afghans themselves," Enayatullah Nazari, acting defence minister, said at the ceremony.
Sixteen inmates, dressed in new shalwar khameez, were freed as part of the ceremony. Three of them who spoke to the AFP news agency all insisted they had been held on baseless accusations and had no links to the Taliban campaign.
Hamid Karzai, the Afghan president, demanded authority over the prison as conditional to addressing long-term Afghan-US relations and possible legal immunity for US troops - the key to troops remaining in the country after 2014.
But the Memorandum of Understanding (MoU) governing the handover is not legally binding, and US forces will retain control of one block at the infamous jail.
Aimal Faizi, Karzai's spokesman, says there are disagreements over the interpretation of the deal and that more than 600 people detained since March 9 have not yet been transferred to Afghan custody.
Jamie Graybeal, a NATO spokesman, says 99 per cent of detainees held before March 9 are under Afghan authority and that the transfer of the rest has been put on hold, pending concerns about the intentions of the government to fulfil the MoU.
He said the US retained the authority to capture and detain suspects, but intended to continue to transfer Afghan detainees to Afghans.
Foreign detainees will remain under US control and American advisers will also stay at the prison until March 9, 2013, he said.
Afghan officials dispute NATO's right to hold detainees, saying that anyone arrested in extenuating circumstances has to be handed over within 72 hours.
Open Society Foundations, the advocacy group, last week raised concerns about discrepancies in the March agreement, the risk of indefinite detention and voiced fears that Afghan detention without judicial review could be subject to abuse.
In March, Afghanistan's human rights commission detailed torture in prisons run by the intelligence service and police force.
Speaking to AFP news agency, Shafiqullah Taheri, the NDS intelligence service spokesman, rejected the claims, saying that rights activists regularly visit detention centres.
In January, Afghan investigators said inmates at Bagram had been tortured, although a report made public gave few details of the allegations made by prisoners.
Hours after the handover, a suicide bomber blew himself up in a crowded main square in the northern city of Kunduz, killing at least 15 people.
Governor Mohammad Anwar said the bomber was on foot and blew himself up next to a group of police officers.