Outraged, Pakistan's new prime minister said he would protest to the Afghan president.
The border skirmish is a new sign of tensions between Pakistan and Afghanistan, two uneasy neighbors.
Pakistan has complained that militants use parts of Afghanistan for sanctuary to stage attacks inside Pakistan.
That claim helps Islamabad counter frequent U.S. and NATO complaints that militants behind much of the violence in Afghanistan come from Pakistan.
Pakistani military officials said in a statement Monday that militants from Afghanistan crossed the border in the northwestern Pakistan's Upper Dir region Sunday night and clashed with Pakistan forces on a patrol.
The military said six Pakistani troops were killed outright. Seven who went missing were killed and then beheaded, while the remaining four have still not been found. The reports could not be independently verified.
Reflecting the particularly gruesome nature of the attack, newly elected Prime Minister Raja Pervaiz Ashraf said he would complain directly to Afghan President Hamid Karzai about the incident.
“We have strongly protested and I will, too, God willing, talk about this to Karzai,” said Ashraf, speaking in Karachi.
Pakistani troops killed 14 of the militants, the military said.
The Pakistani Taliban say their fighters carried out the raid, but the statement didn't say whether the attackers had crossed over from Afghanistan. It said Pakistani claims of militant casualties were false.
Both sides often release false or partial information about such incidents, which usually happen in areas inaccessible to the media.
The deputy border police commander for eastern Afghanistan, Maj. Mohammad Ayub Hassainkhail, said the Pakistani military informed police Monday that one of their patrols was missing. He said they told the Pakistani officials they had no information about any Pakistani military near their checkpoints, but said it is a long border.
“They have plenty of militants on their side. Why would the militants cross over from Afghanistan? I strongly reject this claim that any militants crossed over from Afghanistan to Pakistan and did this,” he said.
The border region between Afghanistan and Pakistan is a hotbed of militant insurgency largely removed from the control of the Pakistani government.
In another development elsewhere in the troubled region, a top Pakistani Taliban commander in South Waziristan said Monday that he would not allow any polio vaccinations in his territory until the U.S. stops drone attacks in the region.
Maulvi Nazir said in a statement emailed to reporters that all organizations doing immunizations should stop immediately.
This follows an announcement earlier this month by another militant commander in North Waziristan also banning polio vaccinations. Pakistan is one of only three countries in the world where polio is still endemic.
The virus usually infects children living in unsanitary conditions, attacks the nerves and can kill or paralyze.
Vaccination programs, especially those with international links, have become under suspicion in Pakistan ever since it became known that a Pakistani doctor ran a fake vaccination program to help the CIA track down Osama bin Laden.
The al-Qaida leader was killed during a raid by U.S. Navy SEALs in the Pakistani city of Abbottabad in May 2011.
Dr. Shakil Afridi had helped the CIA run a vaccination program designed to collect DNA from bin Laden and his family.