Human rights campaigners have criticised Bagram prison
Last September the United States gave Afghan authorities control of more than 3 000 detainees at Bagram, a sprawling detention centre north of Kabul which has in the past been dubbed the Guantanamo Bay of Afghanistan.
But the US continued to guard 50 foreigners not covered by the agreement as well as hundreds of Afghans arrested since the transfer deal was signed in March 2012.
In November Karzai accused the US of breaching the deal, saying prisoners found innocent by courts were still being held and more people had been captured by American forces against the provisions of the agreement.
Kabul made control over the prison a condition for signing a long-term agreement that would allow some US troops to remain in the country after the bulk of Western combat forces withdraw next year.
The US is seeking immunity from local prosecution for any troops that remain.
But implementation of the transfer has been beset by disagreements, and negotiations over the fate of detainees have often ground to a halt.
Transfer to 'take place on Saturday'
"Our efforts for the transfer of the US-run prison, years-long efforts, have eventually paid off and … the transfer will at last take place," Karzai told the opening of a new parliamentary session.
"This transfer of prison will take place on Saturday," he added.
Details of the final agreement have not been released.
The US-led military coalition in Kabul declined to comment, except to confirm that the final handover would take place on Saturday.
The Afghanistan Analysts Network think-tank said this week that disputes over Bagram had led to "rocky times" for Afghan-US relations but now "both sides appear determined to come to some kind of agreement".
It quoted Afghan prison officials as saying that a final group of 400 to 500 detainees were due to be transferred, but that about 50 foreign prisoners – mainly from Pakistan – were not covered by the negotiations.
Karzai said he would order the release of all "innocent" detainees.
'Innocent' prisoners
"We understand that there are some innocent people in these jails. I will order their release, no matter if there is criticism.
"Those who have been involved in killing people or setting off bombs will serve their punishment," he said.
US officials have suggested that some released detainees have returned to the insurgency's fighting ranks, and there are fears that the government is freeing suspected militants to help kick-start peace talks with the Taliban.
Karzai and US President Barack Obama in January pledged to place all detainees under the "sovereignty and control of Afghanistan, while ensuring that dangerous fighters remain off the battlefield".
Human rights campaigners have regularly criticised Bagram prison, 50 kilometres north of Kabul, saying that it fails to comply with international norms because some inmates are detained without trial or knowledge of the charges against them.
There have also been repeated concerns about alleged torture in prisons run by the Afghanistan's National Directorate of Security intelligence service and police force.
A UN report said in January that prisoners were frequently abused and tortured in the Afghan jail system. – AFP