ISLAMABAD, Pakistan — Taliban insurgents executed 15 security soldiers who had been recently kidnapped and dumped their bodies on a hilltop in northwestern Pakistan on Thursday, in retaliation for the killing of a militant commander by government forces, government and military officials said.

The soldiers were kidnapped Dec. 23 after dozens of Taliban insurgents overran a fort in one of the restive tribal regions straddling the border with Afghanistan. Officials said they had tried but failed to secure the captives’ release.

The executions followed the death of a high-ranking Taliban commander on Sunday and came just days after local news media reported that several factions of the Taliban had vowed not to attack the Pakistani military.

The bullet-ridden bodies of the soldiers, members of the Frontier Constabulary, were spotted by local tribesmen on Thursday morning after they were dumped in Mir Ali, a subdistrict in the North Waziristan tribal region. The Frontier Constabulary, run by the Pakistani police authorities, has about 70,000 paramilitary soldiers who operate checkpoints in Khyber-Pakhtunkhwa Province and provide security at foreign embassies and consulates in major cities across Pakistan.