They were among suspects held after the fall of the Taleban in 2001.
A spokesman for President Hamid Karzai said the prisoners had been transferred to Kabul from the US base at Bagram.
At the end of last year, the commander of the US-led military coalition in Afghanistan, Lt Gen David Barno, told the BBC many suspected militants held at US bases could be released shortly.
Human Rights Watch has accused US personnel there of using excessive force, carrying out arbitrary detentions and mistreating people in custody.