Up to 30 civilians and police were rescued from the prison in Helmand province, where the militants have a large presence, during the operation late Saturday.
Among those released were four teenagers, Helmand police spokesman Abdul Salam Afghan said.
Wali Mohammad Ahmadzai, commander of the Afghan National Army’s 215 Corps, said 20 civilians who had been chained up and “a number of police” were sprung from the jail in Nawzad district.
The inmates had been accused by the Taliban of “committing various crimes,” Ahmadzai added.
In a statement the Taliban said the prisoners were all criminals.
The Taliban operates its own courts and prisons in areas under its control. While punishments can be harsh the system is often seen as being more efficient and less corrupt than the official one.