A CIA prisoner whose treatment set the torture template in the agency’s notorious Salt Pit jail outside Kabul, and another known as a “ghost prisoner” – held in such secrecy that for years even his name was classified information – have disappeared into Afghanistan’s prison system, where they are once more at risk of torture.

The US military handed the two men to the Afghan government earlier this month, along with several other unidentified foreign captives who are believed to be citizens of Uzbekistan and Tajikistan, when they closed a notorious jail on Bagram airbase.

“They are in the custody of the Afghan security forces and there is reason to believe there is a very real risk of torture,” said Tina Foster of the International Justice Network, which had been representing men held inside the shadowy prison for over eight years.

The prisoners at Bagram did not enjoy even the meagre protections offered those in Guantánamo, access to a lawyer or to be named, which is why many were dubbed “ghost captives” and remain unidentified even after their release.

The prison’s closure was expected to end more than a decade of controversy about mistreatment and a years-long legal battle over the prisoners’ rights, but for men now languishing in Afghan jails the nightmare goes on. Although Afghanistan should give the men more rights, including visits from their lawyers, there have been repeated reports of abuse in the country’s jails, from beatings to interrogators ripping out toenails and twisting prisoners’ genitals.

United Nations reports raised such serious concerns in recent years that Nato forces twice halted all prisoner transfers. Despite government promises of a crackdown since then, there have been credible reports that torture has persisted under some commanders.

The US authorities did not respond to repeated requests about who was holding the men, where they were imprisoned, or if safeguards were in place to protect them from torture.

“The fact that you are holding people without identities makes it hard to protect them,” said Kate Clark, of the Afghanistan Analysts Network, who has written extensively about detentions and abuse. “Torture is illegal but it continues to be deployed.”

The two Tunisians were captured in 2002 and appear as prisoners 6 and 20 on a Senate list of men the CIA subjected to “enhanced interrogation”, as the organisation called its brutal techniques.

Redha al-Najar, now 49, was the first man to be sent to the Salt Pit, perhaps the most notorious of the CIA’s secret jails in Afghanistan. His treatment there “became the model” for the abuse of other detainees, the Senate report on CIA torture found. For two days he was suspended by his wrists from the ceiling in diapers. At other times he was kept in isolation and total darkness, at uncomfortably cold temperatures – another detainee there died of hypothermia. After a month, interrogators described him as “clearly a broken man”.

He was accused of having served as Osama bin Laden’s bodyguard, something that only emerged in the Senate report. “Reading this was the first time I had the slightest inkling this was the charge against him,” said Sylvia Royce, a second lawyer representing him and the other Tunisian, Lotfi al-Ghrissi. She has never been allowed to meet either client or to correspond with them. Their families asked her to represent them.

Al-Ghrissi is now 45 and was seized near the Afghanistan-Pakistan border, probably on the Pakistani side. For years his identity was unknown and the Senate report reveals no details of how he was treated, or the allegations against him.

The Afghan president, Ashraf Ghani, slammed the CIA torture as “shocking” and “inhumane” and vowed to defend the dignity of those who had been mistreated. His spokesman said the “few prisoners” transferred from Bagram would be “dealt with in accordance with the Afghan and humanitarian laws”.

Under Afghan law, individuals must be charged or released after 72 hours in detention, Clark said. That period can be extended, but only through the judicial system. There is no provision for indefinite detention.

The Tunisians’ best hope is that their government, which had sent a diplomat to visit them in Bagram, seeks their repatriation. Officials may have been prevented from arranging a transfer only by the turmoil of elections at home.

The other detainees are anonymous, with no names, ages, or even date of capture known. Their future appears to offer a bleaker choice between legal limbo in Afghanistan or repatriation to countries where they would be likely to face torture or execution.

“It is hard to see how they could be prosecuted. There isn’t any evidence against them, they were not captured in Afghanistan, and they were not part of the conflict in Afghanistan,” said Foster, the lawyer.