They said the attack in the Bajur tribal region prompted a gunbattle, still underway hours later.
The officers spoke on condition of anonymity because they are not authorised to talk to media. Their accounts could not be independently verified because of the remoteness of the region.
Pakistan and Afghanistan share a volatile and porous border that is often the scene of cross-border attacks. Militants from both countries also cross the border to use the neighboring country's soil as a safe haven.