QUETTA — Five militants attacked a security post in southwest Pakistan in the early hours Wednesday, triggering an intense shootout that left nine soldiers, five attackers and a female passerby dead, officials and the military said.

The newly formed militant group Tehreek-e-Jihad Pakistan claimed responsibility for the attack in a statement, without providing further details.

Hours after the attack, Pakistan’s military said in a statement that “a group of terrorists launched a dastardly attack” in the garrison district of Zhob in the southwestern Baluchistan province. The “initial attempt of terrorists to sneak into the facility was checked by soldiers on duty,” it read. The shootout left three militants and four soldiers dead, while five troops were critically wounded.

The military later said the security forces in a search operation killed two more attackers who had escaped. Earlier, a senior government official, Azam Kakar, said the militants were armed with assault rifles and apparently wanted to sneak into a compound housing military offices and troops’ residences.

Kakar said the shootout lasted for hours and a woman died after getting caught in the crossfire.

The gas-rich Baluchistan province at the border of Afghanistan and Iran has been the scene of a low-level insurgency by Baluch nationalists for more than two decades. Baluch nationalists initially wanted a share of the provincial resources, but later they initiated an insurgency for independence.

Pakistani Taliban and other militant groups also have a strong presence in the province.