The Afghan Intelligence service (NDS, a combination FBI/CIA) has been corrupted by cash and political threats. This is a big problem for foreign troops in Afghanistan, especially NATO ones, who are supposed to hand over captured Taliban to the NDS. But often, if too many Taliban are captured, the NDS will refuse to take them all (usually claiming too little evidence to justify holding them.) Some of the captured Taliban will, once in the hands of the NDS, claim they were tortured by the foreign troops. If this gets out into the local media, it becomes a big deal. While Afghans can torture Afghans, and that's not news, for non-Moslem foreigners to do it is very bad. The NDS doesn't want the bother, and will often, especially with the help of a cash bribe or a threat from some senior government official, or tribal chief, just let the guy go. Many of the most valuable Taliban prisoners have enough cash, or powerful enough friends, to persuade the NDS to let them go.
The foreign troops find they are capturing the same Taliban fighters over and over again, or finding, after a battle, the dead bodies of Taliban gunmen they had turned over to the NDS recently. The NDS claim that all this is not their fault, but you don't have to be in Afghanistan long before you realize that the corruption extends to everything, and that the Taliban use it whenever they can. The Americans maintain their own prisons, and tend to ignore complaints of torture. Thus NATO allies are most often screwed by the NDS.