The gunmen launched their attack around midnight with a series of heavy explosions before firing rocket propelled grenades and machine guns, a senior police official said.
During the attack on Central Prison in Dera Ismail Khan of Khyber Pakhtunkhwa province bordering the restive South Waziristan agency, the militants killed six policemen, six Shia prisoners and two private security guards, he said.
"Five more policemen and two civilian were injured in the attack," said deputy commissioner Amir Khattak.
Six of them were re-arrested during the night operation while eight were picked up in the morning from different localities during search operation.
More From This Section
Curfew has been clamped in the areas where search operation was underway.
Meanwhile, new Tehrik-i-Taliban Pakistan (TTP) spokesman Shahidullah Shahid has accepted responsibility for the attack. Speaking to Dawn daily, he said that around 100 militants took part in the attack including a number of suicide bombers among them.
He said the TTP has achieved their targets and their operation was successful.