A roadside bomb and gunfire hit the convoy as it traveled from Sakhakot town near Swat to the main northwestern city of Peshawar early Saturday, an army statement said. One soldier also died in the attack and five were wounded, it said.
The army identified the prisoners as Muhammad Maulana Alam and Ameer Izzat Khan, top aides to hard-line cleric Sufi Muhammad who negotiated a peace deal with the government that was widely seen as allowing the Taliban to seize control of the Swat Valley.
The deal collapsed earlier this year when the Taliban advanced into neighboring districts, triggering a military offensive that prompted a spree of retaliatory attacks by militants in the northwest and beyond.
A military official, speaking on condition of anonymity because he was not authorized to talk to media, said the prisoners' deaths was apparently an accident because the attackers would not have known they were in the convoy.
But Rasul Bahksh Rais, a political scientist at Lahore University, said the killings may have been deliberate to prevent Alam and Khan from giving the military information that could help find Taliban leaders in the Swat region.
"I think it was a targeted killing by the militants because they could identify the whereabouts of some of the militant" leaders, Rais told the Express 24/7 television network. "They were high-value targets."
No senior Taliban figures have so far been captured or killed in the month-old army offensive in Swat, which is seen as a test of Pakistan's resolve to take on militants who have challenged the central government's rule by strengthening their influence in the border region with Afghanistan.
Security forces detained Alam and Khan during a raid last Thursday at a religious school in a district near Swat. Another aide to Muhammad, Syed Wahab, was also seized. It was not immediately known if Wahab was in the convoy on Saturday.
The Taliban have vowed a campaign of retaliatory attacks for the military offensive, and a series of bombings and shootings have hit security forces and civilian targets, including a marketplace and a bus stop.