Afghan special forces, operating with NATO support, freed more than 15 people being held by the Taliban in southern Helman province.
According to a press release, the prison was in No Zad village in the Helmand province, and raid took place at night.
Several Taliban were also detained, and improvised explosive device making materials were removed.
The rescued Afghans were taken to a secure location where they were screened before being released.
The special forces are known as the Afghan Commandos, and have been working to liberate the country from Islamic State and Taliban forces. They deploy out of bases in Kandahar, Helmand and Kabul.