The main prison is Kabul is Pol-i-Charkhi, a forbidding-looking place off the Jalalabad road in the east of the capital, which was shrouded in smog yesterday. It has a grim reputation, built in the 1970s and used by the communist government as a place of torture and execution.
I was inside it once just after the fall of the Taliban in 2001 when there was briefly nobody in its cramped cells and holding pens. Assuming it has not changed much, it is easy to see why Afghans are eager to get relatives, friends and associates out of the place or out of any other prison in Afghanistan.
Almost any method from straight bribery to family, political, or tribal influence is likely to be used. One of the many reasons why it is so dangerous for foreign correspondents to meet with the Taliban is that their commanders often have relatives in prison who they want to get out. Kidnapping a foreign journalist and offering to make an exchange is one way of freeing them.
A more usual method of getting prisoners released is political influence or money. There is no wall separating the Taliban from the rest of Afghan society so they may have influential friends within the government. US diplomatic cables released by Wikileaks show American frustration in 2009 because President Hamid Karzai had freed 150 detainees, including 29 former prisoners from Guantanamo. But Mr Karzai, who knows that Washington has no alternative Afghan leader to replace him, has ignored protests and freed prisoners whom the US would like him to hold.
Of course not all people whom the US-led forces claim are dangerous Taliban leaders are really so. Prisoners frequently claim that the Afghan police and security forces arrest them on false charges in order to extract a bribe in letting them go free.
In 2002 US guards were accused of killing two prisoners at Bagram, one of whom was a taxi driver whom they had picked up at random. The guards were amused by the fact that he cried "Allah" at every blow and took turns to beat him to death.
The Afghan government is saturated by corruption and money presumably plays a role in the release of some prisoners, but the government's motives are often unclear or appear inadequate.