The release was ordered by President Hamid Karzai several weeks ago, after his government took over the prison from US troops.
The decision prompted angry denunciations from Washington and strained relations between the two countries ahead of the year-end withdrawal of most international combat troops. US forces in Afghanistan say some of the men are responsible for killing or wounding dozens of international and Afghan soldiers.
The prisoners were freed just after 9 a.m. from the Parwan Detention Facility near Bagram Air Field, about 45 kilometers (28 miles) north of Kabul, according to prison spokesman Maj. Nimatullah Khaki.
They boarded a bus to leave the facility, laughing and smiling, he said.
The US has argued for the detainees to face trial in Afghan courts citing strong evidence against them, from DNA linking them to roadside bombs to explosive residue on their clothing but Kabul has cited insufficient proof to hold them.
Karzai, too, has referred to the Parwan prison as a "Taliban-producing factory" where innocent Afghans are tortured into hating their country.
The US military late Wednesday night issued a strongly worded statement condemning the imminent release, which it said would include detainees directly linked to attacks that have killed or wounded 32 US or coalition personnel and 23 Afghan security personnel or civilians.
AP/REUTERS