The army had made “substantial sacrifices” to protect the country against terrorism, Prime Minister Nawaz Sharif said in a statement, adding, “Such cowardly acts by terrorists cannot deter the morale of our armed forces.”

On Saturday, the Khyber-Pakhtunkhwa provincial government, which is controlled by Mr. Sharif’s political rival, Imran Khan, announced that the withdrawal of army troops from Swat would start in mid-October. In the first phase, soldiers would pull out of the Buner and Shangla districts, the government said.

Mr. Khan has for years advocated talking to the Taliban instead of fighting them, a position that has now become the national government’s policy. A meeting of all the major parties on Sept. 9, which was convened by Mr. Sharif and included the army chief, Gen. Ashfaq Parvez Kayani, authorized the government to initiate a peace process.

But the killing of such a senior officer on Sunday could cast doubt over any talks, analysts said.

“The government’s difficulties have increased,” said Rustam Shah Mohmand, a retired diplomat, while talking to Capital TV, a private news network. “Today’s incident seems aimed at sabotaging the peace talks. It remains to be seen whether the Taliban faction that is opposed to talks can influence senior Taliban leaders.”

An apparent Taliban statement, also reported in the Pakistani news media, echoed the view that peace talks could be distant. “We are at war with the Pakistan government, and we are assessing their sincerity about peace talks,” Shahidullah Shahid, a Taliban spokesman, was quoted as saying. “If we find that the government is serious, we can talk. Otherwise, we will continue our attacks.”