Pakistani commandos stormed a building near army headquarters in Rawalpindi and freed 40 hostages being held there by suspected Taliban militants.
The army began the operation to release them early on Sunday morning and loud explosions and gunfire could be heard from inside the base, the BBC reports.
Military officials say three hostages were killed in the operation along with at least four hostage takers, one of whom was wearing an explosives belt.
One insurgent was wounded but arrested alive.
Military officials say the operation is now over.
Six soldiers and four militants were killed in the initial assault.
Senior military officials and civilian personnel were reported to be among the hostages.
The attack came as the army was preparing for a major operation against the Taliban, and officials said the militant group had claimed responsibility.