(Updates with Taliban comment)
By Katharine Houreld
ISLAMABAD, Sept 15 (Reuters) - A roadside bomb killed a Pakistani general and another officer on Sunday near the border with Afghanistan, the Pakistani army said, rare high-ranking casualties in Pakistan's war against militants.
Major General Sanaullah Khan, along with a lieutenant colonel and another soldier, were killed in the Upper Dir district after visiting an outpost near the border, the army said.
Taliban spokesman Shahidullah Shahid claimed responsibility for the bombing, which Pakistani Prime Minister Nawaz Sharif said would not affect the fight against militants.
"Pakistan army has made substantial sacrifices to protect the nation against the menace of terrorism and such cowardly acts by terrorists cannot deter the morale of our armed forces," Sharif said in a statement.
The attack comes after weeks of discussions within Sharif's government about whether to pursue peace talks with the Pakistani Taliban, who are separate from Afghanistan's Taliban, although allied with them.
Last week, major political parties held a conference on the issue and agreed that talks should be pursued.
But it was not clear when talks might begin, who might take part or if they would be held under any conditions.
The killing of Khan and his colleagues would likely make it more difficult for the government to enter negotiations.
The Pakistani Taliban, an umbrella group of different factions, have said they would have their own meeting to decide whether to negotiate with the government. Analysts said it might be difficult for them to reach an agreement.
Taliban spokesman Shahid said the attacks would continue while the militants decided if the government's offer was genuine.
"If we find them serious we can talk, otherwise we will continue our attacks," he said.
The Taliban said last year that they would only consider talks if the government imposed strict Islamic law and went to war with old enemy India.
But Sharif's government, which came to power this year, has made improving ties with neighbouring India a priority. (Additional reporting by Saud Mehsud in Dera Ismail Khan; Editing by Robert Birsel)