All 33 suspected militant prisoners who took hostages after seizing control of a Pakistan police station were killed in a clearance operation on Tuesday in which two special forces troops also died, the defence minister said.
"All the hostages have been freed," said Khawaja Muhammad Asif. "Ten to 15 men from the SSG (special forces) including an officer were wounded while two were martyred."
More than 30 men connected to militant groups including the Tehreek-e-Taliban Pakistan (TTP) overpowered their jailors on Sunday and snatched weapons.
"The operation has successfully been completed," the minister said at a press conference in the capital Islamabad, adding some hostages had "lost their lives".
He said special forces moved in when differences broke out between the suspected militants over how to handle the hostages.
The men, who were being held on suspicion of terrorism, had demanded safe passage to Afghanistan in return for releasing the hostages -- at least eight police officers and military intelligence officials -- Muhammad Ali Saif, a spokesman for the provincial Khyber Pakhtunkhwa government, said earlier.
The TTP, separate from the Afghan Taliban but with a similar hardline Islamist ideology, said its members were behind the incident and demanded authorities provide them safe passage to border areas.
The police station is within a cantonment area in Bannu, adjacent to Pakistan's formerly self-governed tribal areas and near the border with Afghanistan.
Local schools were ordered shut on Tuesday out of fear of more kidnappings, a senior government official in the district told AFP.
Offices and roads have closed, and checkpoints have been set up around the area.
Pakistan had asked the Taliban in Kabul to help with the release of the hostages, the senior government official told AFP.