At least eight militants were shot dead and two Pakistani soldiers died in a skirmish along the border with Afghanistan, Pakistan's military said on November 13.
"Terrorists from Afghanistan side attempted attack on Pakistani posts" along the border in Bajaur in the tribal districts of northwest Pakistan, the military said in a statement, adding that 8-10 of the attackers were killed.
Two soldiers -- Captain Junaid Hafeez and Sepoy Raham -- died while four soldiers sustained injuries, it said.
AFP cited Pakistani security officials as saying the attack occurred on November 13.
Afghanistan's failure to control its side of the border made it easy for "terrorists" to launch such raids, the Pakistani military said.
There was no immediate response from the Afghan government. Independent verification of the incident was not possible as the area is largely closed off to reporters.
Islamabad and Kabul regularly accuse each other of harboring militants who cross their porous, 2,400-kilometer long border to carry out attacks.
Over recent decades, members of the Afghan Taliban, Al-Qaeda, and other extremist groups have operated seemingly with impunity in the region.
In March, Pakistan began what it said were plans to fence much of the border, which follows the so-called Durand Line that was drawn by British rulers in 1896.
Kabul does not recognize the Durand Line as an international border and has objected to Pakistan's new border fortifications.
The fencing also threatens to disrupt the daily lives of people living in communities that straddle the border. In some villages, mosques and houses reportedly have one door in Pakistan and another in Afghanistan.
They now face stricter controls and must use official crossing points, which are subject to delays and frequent closures.