(CNN) -- Seventeen Pakistani soldiers who were kidnapped last week are shown beheaded in a video released by the Taliban.
A senior Pakistani military official confirmed to CNN that the bodies shown in the video, their identifications flashed before the camera as evidence, indeed belonged to members of the Pakistani army and a Pakistani paramilitary force.
Taliban spokesman Ehsanullah Ehsan provided the video, which restates the militants' goals -- to sever Pakistan's alliance with the United States and to bring sharia law to Pakistan.
The names of the dead are recited in the video.
"We are not the enemies of Pakistan and its people. In fact, we are enemies of the infidels and the democratic system that has been imposed upon us," the video says.
The Pakistani military official, who spoke on the condition of anonymity because he is not authorized to speak to the media, said the soldiers were kidnapped last Friday.
The soldiers were on a routine patrol in the Upper Dir district of Pakistan, near the Afghan border, when more than 100 militants who crossed the border from Afghanistan attacked, the official said.
Fifteen militants were killed in the fight, but the 17 soldiers were captured, he said.
The militants, who belong to the Pakistani Taliban and other groups, then crossed with their prisoners back to Afghanistan, the official said.
Militants based in Afghanistan have killed more than 100 Pakistani soldiers in cross-border attacks since 2010, the official said.
"It was very sad but it won't demoralize our troops," he said.
The official said that NATO and the Afghan government have "badly failed" at stopping militants from entering Pakistan.
CNN's Nasir Habib contributed to this report.