Media playback is unsupported on your device Media caption Col Robert Taradash: "We transferred more than 3,000 Afghan detainees into your custody at an expedient rate"

The US military has handed control of a controversial prison housing more than 3,000 Taliban fighters and terrorism suspects to the Afghan authorities.

In a small ceremony, Afghan officials said inmates had been transferred to their authority.

The move is part of a deal to transfer all Afghan prisons back to local control ahead of the withdrawal of Nato forces at the end of 2014.

Bagram prison has been at the centre of a number of prisoner abuse allegations.

Although Afghan President Hamid Karzai has hailed the handover, disagreements with the US remain.

Washington is insisting that it will maintain control over some detainees in the prison.

Meanwhile, a new report suggests that some Taliban are open to a general ceasefire or political agreement allowing for a continuing US military presence after 2014.

'Glorious ceremony'

The handover took place at a brief ceremony which correspondents say was poorly attended by US and Nato officers.

Analysis For President Karzai, the handover of Parwan detention facility is a matter of sovereignty. But for the Americans there are issues of trust. Even as the official handover ceremony takes place, there are still deep divisions. At the crux of the disagreement is the US insistence that it retains the right to arrest and hold prisoners caught "on the battlefield". While about 3,000 prisoners have already been transferred, the US is still believed to be holding on to hundreds of others and around 50 nationals from "third countries", such as Pakistan. Among US concerns are what would happen to "high-value detainees" once handed over to the Afghans - could they be released? But human rights groups and some Afghans are worried that continued US control of part of the prison could lead to the creations of "Guantanamo's twin brother".

"We transferred more than 3,000 Afghan detainees into your custody... and ensured that those who would threaten the partnership of Afghanistan and coalition forces will not return to the battlefield," said Col Robert Taradash, the only US official at the ceremony.

"Our Afghan security forces are well trained and we are happy that today they are exercising their capability in taking the responsibility of prisoners independently and guarding the prisoners," said acting Defence Minister Enayatullah Nazari.

"We are taking the responsibility from foreign forces."

AFP news agency photos showed a small group of inmates being released as part of the ceremony.

Now officially known as the Parwan Detention Centre, Bagram prison lies about 40km (25 miles) north of the capital, Kabul.

It was once located in one of the largest military bases for Nato-led forces in Afghanistan, but the new Parwan facility was constructed a few miles away and populated with inmates in 2010.

The US military still wants to run a section of the jail and is not handing over hundreds of detainees, saying it has the right to hold insurgents caught on the battlefield, the BBC's Jonathan Beale in Kabul reports.

Media playback is unsupported on your device Media caption Director of Centre for Conflict and Peace Studies: "The transfer is a positive step but there are many obstacles that still need to be addressed"

These include about 50 foreigners not covered by the handover agreement signed in March.

Privately, the US is concerned that some high-value inmates could be released if they are handed over, our correspondent says.

That has angered the Afghan president, who says that full Afghan control is an issue of sovereignty.

According to Afghan officials, there is a dispute over 34 inmates in particular, but they say they have made it clear they do not want control over the foreign prisoners.

Meanwhile the director of the Centre for Conflict and Peace Studies, Hekmat Karzai, told the BBC that the Americans believed they had a strategic interest in keeping these detainees.

"The argument is that while they have troops on the ground it's very difficult to release these people," said Mr Karzai, who is a cousin of the Afghan president.

Bagram timeline 1979-88: Key base for troops and supplies during Soviet occupation

Key base for troops and supplies during Soviet occupation 2001: Air base taken over by coalition forces following fall of Taliban regime, also becomes the main US detention facility in Afghanistan

Air base taken over by coalition forces following fall of Taliban regime, also becomes the main US detention facility in Afghanistan July 2005: Escape by four "dangerous enemy combatants", the first by any prisoners

Escape by four "dangerous enemy combatants", the first by any prisoners February 2007: Suicide attack outside base during visit by US Vice President Dick Cheney kills more than 20 people

Suicide attack outside base during visit by US Vice President Dick Cheney kills more than 20 people 2010: Thousands of prisoners moved to Parwan Detention Centre, built outside base with extra capacity to replace old prison

Thousands of prisoners moved to Parwan Detention Centre, built outside base with extra capacity to replace old prison April 2010: Allegations surface of prisoner abuse at a hidden facility at Bagram

Allegations surface of prisoner abuse at a hidden facility at Bagram February 2012: Violent protests erupt after US troops inadvertently burn copies of the Koran at Bagram - at least 30 people are killed In pictures: Bagram prison handover 'Rebranding' US detention in Afghanistan Afghan media question Bagram jail deal

Bagram has been described as "Afghanistan's Guantanamo" for its troubled past of prisoner abuse and indefinite detention, our correspondent says.

In January 2012, Afghan investigators accused the US Army of abusing detainees at Bagram.

The investigators said prisoners had reported being tortured, held without evidence and subjected to humiliating body searches.

Nato and the US have rejected allegations of abuse as untrue and pointed to the fact that they have given the Afghan Human Rights commission access to check them independently.

In February this year, US soldiers unwittingly burned Korans confiscated from prisoners at Bagram, leading to days of protests and targeted killings across Afghanistan. A US investigation said there was no malicious intent to disrespect Islam.

Separately, a new report has suggested some Taliban may be open to a continuing US military presence after 2014, as long as the role is strictly defined.

A briefing paper by the Royal United Services Institute contains interviews with four senior Taliban figures, in which they say they will not negotiate with President Karzai but are prepared to renounce their association with al-Qaeda as part of a comprehensive peace agreement.

The report says some Taliban recognise that hosting al-Qaeda before 2001 was a mistake

The BBC's security correspondent, Gordon Corera, says talks between the Taliban and the US in the past have stumbled and there remains a crucial question mark over whether the views expressed in this briefing are representative of a broad swathe of Taliban opinion rather than just the more moderate elements.