The Afghan government has ordered the release of 72 prisoners from Bagram jail, despite Washington's insistence that the men were involved in killing dozens of US and Afghan troops and pose a serious threat to the country's security.

The decision adds new strain to Kabul's difficult relationship with Washington. The two countries are already at odds over a draft deal to keep US forces in the country to carry out counter-terrorism operations and train Afghan troops after their combat mission ends this year.

The prisoner release was agreed at a meeting of top judicial officials, chaired by President Hamid Karzai and that included the attorney general and the justice minister.

Karzai had asked the Afghan spy chief to draw up dossiers on the controversial prisoners, but investigations in Kabul and the provinces only turned up solid evidence against 16 of them, the president's spokesman, Aimal Faizi, said. Their cases have been sent to the attorney general's office and will be handled through the legal system.

Of the others, 45 were deemed completely innocent with no evidence emerging against them, Faizi said. The names of the remaining 27 had appeared in files but there was "nothing direct and concrete" connecting them with attacks.

"We know there will be disagreements and the Americans will not be happy with this decision, but this is our duty," he said.

"We cannot allow innocent Afghan citizens to be kept in detention for months and years without a trial, for no reason at all. We know that unfortunately this has been happening at Bagram, but it is illegal and a violation of Afghan sovereignty."

The US embassy and Nato forces in Afghanistan did not comment, but they have previously said there is "ample evidence" to suspect all the men of a role in attacks that killed or wounded 60 foreign soldiers and 57 Afghans.

DNA and fingerprint evidence links some men to killings, while others were captured with large weapons caches, the military-backed Stars and Stripes newspaper reported.

In the past the US has said that some of the most dangerous prisoners were captured on the basis of intelligence too sensitive to share. Their concerns are also underpinned by a pattern of dangerous fighters being released from jail by the Afghan government and returning to the battlefield.

Among those set free were the deputy Taliban commander for southern Kandahar province, who was released days Canadian forces captured him in 2010. In 2007 a top fighter from western Afghanistan walked out of prison on Karzai's orders, after village elders vouched for him. He was soon uniting feuding insurgent factions, and was personally responsible for the deaths of more than 30 policemen before he was killed in 2009.

The 88 prisoners were among thousands the US once held at Bagram, which was finally transferred to Afghan authorities last March after years of pressure from Karzai.

The terms of the handover were not made public, but were believed to include a tacit Afghan acceptance of the controversial US provision of "administrative detention", allowing indefinite imprisonment in cases where classified evidence cannot be presented in court or would not result in a conviction.

Afghanistan has not previously used the system, which has been criticised by human rights groups, and it appears that Karzai and his ministers have now rejected it.

The two governments are already at odds over a bilateral security agreement that would keep US troops in the country for another decade. After the US believed negotiations were finished, and a national assembly of prominent Afghans endorsed the deal at the end of last year, Karzai made new demands and said he was happy to delay signing for months until they were met.

Washington has demanded a speedier decision, and warned that Barack Obama is contemplating a "zero option" of taking all troops home, as he did in Iraq. Karzai believes the US will not leave, and is trying to threaten Kabul with the prospect of total departure, Faizi has said.