Pakistani security forces have retaken a police station that was captured, killing all 33 hostage-takers, the defence minister has said.
Islamist militants from the Pakistani Taliban seized the centre in the remote north-western Bannu district on Sunday.
Several people, including security officials, were inside at the time.
Defence Minister Khawaja Muhammad Asif said all hostages were freed, two special forces killed, and 10 to 15 members of the military injured.
The Pakistani Taliban – also known as the TTP – confirmed it was behind the attack, according to a statement reported by local media.
The group stepped up its attacks after ending a ceasefire with the government last month. The two sides have been locked in conflict for years.
The group emerged in 2007 and was suppressed by a military operation in 2014, before re-emerging.
It is separate to the Afghan Taliban, though it has been more active since the Afghans agreed a peace deal with the US in 2020, and took control of the country last year. The two groups share a hard-line Islamist ideology.
The hostage incident unfolded in a region near the two countries’ shared border.
Explaining events, Mr Asif told parliament that the 33 militants had links to different groups, and were being held in a counter-terrorism compound.
He said the hostages were taken after one militant hit a guard on the head with a brick and snatched his weapon.
The militants are said to have requested a safe exit in return for releasing the hostages. A standoff emerged as negotiation efforts failed.
Army commandoes are said to have taken the chance to take back the police station at 12:30 local time (07:30 GMT) after the hostage-takers found themselves arguing among themselves.
Witnesses of the siege reported explosions and heavy gunfire.
Mr Asif told parliament that “all the terrorists” had been killed, and all the hostages freed – without specifying what the latter number was.
He blamed a “total collapse” of the provincial Khyber Pakhtunkhwa government for the deadly incident.
Nearby schools, businesses and roads remained closed on Tuesday, with police checkpoints in place.
The incident came amid a wave of deadly attacks in Pakistan – many of these targeting the security forces.
Four policemen were killed during a separate attack elsewhere in Bannu on Sunday.