In violence elsewhere in the country, 15 rebels and troops were also killed, the officials said on Sunday.
The beheaded victims were part of a 25-member patrol in southern Helmand province that was attacked late on Saturday by rebels driving four four-wheel-drive pickups, said the province's Governor Sher Mohammed Aghunzada.
"The Taliban cut the heads of all the soldiers who were killed," he said. Aghunzada also said the dead soldiers' bodies had been recovered.
The news comes a day after a purported Taliban spokesman, Mullah Latif Hakimi, claimed that the rebels had beheaded a US Navy SEAL commando missing since 28 June in the mountains in eastern Kunar province, also near the border with Pakistan.
American officials have been skeptical of Hakimi's claim and US military spokeswoman Lt. Cindy Moore said on Sunday that the search for the commando was continuing.
No proof of capture
Hakimi has offered no proof to back his repeated claims that the rebels were holding the commando, or that they had killed him.
The commando is the last of a four-member elite military team missing in the province. One of the men was rescued and the other two were found dead.
A US helicopter was shot down
killing all 16 Americans on board
The Navy SEAL team went missing after a special forces helicopter carrying reinforcements to the mountainous area was shot down, killing all 16 Americans on board, the deadliest single attack on the US military since the war began in 2001.
There have been few beheadings in Afghanistan since the war began to oust the Taliban.
In the Helmand ambush, 15 of the soldiers, including three, who were shot and wounded, fled the area after coming under attack, Aghunzada said.
The assailants launched the assault after driving across the border, which is unguarded in remote area, from Pakistan and then returning across the frontier afterward, the governor said.
Afghan officials have long accused Pakistan of not doing enough to crack down on rebels on its side of the frontier. The officials even say privately they believe some elements of the Pakistani army and intelligence network are helping Taliban and al-Qaida members.
Pakistan vehemently denies the charges. Officials boast that they have stationed tens of thousands of troops along the border and arrested more than 700 al-Qaida suspects.
Meanwhile, 12 Afghan soldiers were killed on Sunday when a land mine blew up under their vehicle in Paktika province, also near the border with Pakistan, provincial deputy police chief Ghulam Nabi said.
He said it wasn't clear if the mine was one of hundreds of thousands of old mines left over from a quarter century of fighting, or had been newly planted.
"The Taliban cut the heads of all the soldiers who were killed"
Sher Mohammed Aghunzada,
Helmand province governor
Also on Sunday in fighting in southern Kandahar province, three suspected rebels were killed after attacking a government convoy on the main highway linking the region to the Pakistani border, frontier security chief General Abdul Raziq Khan said.
In the capital on Sunday, a rocket slammed into the centre of Kabul, exploding on a roadside near the US embassy and other diplomatic missions, but there were no casualties and little damage to nearby buildings.
The noise of the blast reverberated around the city at dawn and was a reminder to residents - including 3000 aid workers, diplomats and other foreigners - of the threat that an unprecedented spate of rebel violence that has left about 700 people dead in three months poses to Afghan's future.