More than a dozen people were killed in an overnight battle between Pakistan paramilitary troops and militants who stormed their base and took families hostage, the army said.
"Well equipped" fighters assaulted a Frontier Corps compound in Muslim Bagh, Balochistan province, and captured three families in a residential block, the military said.
Fighting raged from Friday evening until Saturday morning and "the complex clearance operation involved hostage rescue operation", the Inter-Services Public Relations (ISPR) said in a statement.
No group immediately claimed responsibility for the attack but ethnic Baloch separatist groups have for decades waged a rebellion against the state in the southwestern province, frequently targeting security forces.
The Pakistan Taliban is also active in the region.
"The terrorists had not even spared children" in their hostage-taking, ISPR said. All six militants who breached the compound were killed, it said.
Fighting raged from Friday evening until Saturday morning and "the complex clearance operation involved hostage rescue operation", the Inter-Services Public Relations (ISPR) said in a statement.
Six more people, including a woman, were wounded.
A funeral service for some of the men killed was held in Balochistan's provincial capital Quetta on Saturday.
Separately on Saturday, the ethnic separatist Baloch Liberation Army claimed to have staged an attack on security forces guarding an oil and gas survey team further south in Balochistan's Kalat region.
Pakistan has witnessed a dramatic uptick in attacks since the Afghan Taliban surged back to power in neighbouring Afghanistan in 2021.
The assaults have been focussed on regions abutting Afghanistan, and Islamabad alleges some are being planned on Afghan soil.
In January, a suicide bomber linked to Pakistan's Taliban blew himself up in a mosque inside a police compound in the northwestern city of Peshawar, killing more than 80 officers.