Burqa-clad Taliban militants on Monday stormed a police station used by local intelligence personnel at Bannu in northwest Pakistan and took several hostages, before security men stormed the building to end the siege.
Four Taliban fighters were killed and another captured following a heavy exchange of fire.
Two militants wearing suicide vests blew themselves up while two more were shot dead by security forces. The fifth attacker was arrested by the police.
Nearly 10 security personnel were injured. Initial reports had said a policeman was killed but officials later clarified that he was seriously injured.
A group of five attackers, all wearing burqas, stormed the police station at around 9.45 am after lobbing several grenades.
At least eight policemen taken hostage by the militants were freed at the end of the three-hour siege. The banned Tehrik-e-Taliban Pakistan claimed responsibility.
Taliban spokesman Ehsanullah Ehsan told reporters in the northwest on phone that his group's fighters, including suicide bombers, had taken part in the attack.
Security forces, including army soldiers, cordoned off the area and surrounded the building. Curfew was imposed in Bannu.
The building stormed by the militants is used by the intelligence wing of the local police force.
Today's assault was the latest in a string of deadly attacks by the Taliban on security forces.
Militants killed eight security personnel in an attack on an army camp near Gujarat and 10 policemen in a raid in Lahore last week.
Bannu city is located close to the restive North Waziristan tribal region and militants have carried out several audacious attacks in the area.
In April, nearly 400 prisoners escaped from the central prison in Bannu after an attack by scores of Taliban fighters.
That attack was carried out to free Adnan Rashid, who was sentenced to death by a military court for an attempt on the life of former President Pervez Musharraf in 2003.
Will the US ever declare Haqqanis a terrorist group?
Special: Pakistan government to finally clip ISI wings
Lashkar may try to free jailed 26/11 mastermind Lakhvi
Taliban gunmen attack Pak police camp in Lahore, kill 9
Will the US ever declare Haqqanis a terrorist group?