The Afghan government has agreed to hand over the body of Taleban commander Mullah Dadullah in exchange for the release of hostages, officials say.
Mullah Dadullah is the most senior militant to be killed in recent years
They say that President Karzai ordered the body to be swapped for five health workers kidnapped in Kandahar province.
Mullah Dadullah's body will be handed over to a person nominated by his family to collect it, officials say.
The Taleban commander, who was killed last month, was accused of a string of bombings, beheadings and kidnappings.
The five male kidnap victims - a doctor, three nurses and their driver - were abducted in Kandahar in March.
Their captors at first demanded the release of Taleban prisoners, but instead agreed to exchange them for the body of Mullah Dadullah, officials say.
It will take the Taleban time to recover from Dadullah's loss
"Yesterday it was agreed to," said Abdullah Fahim, a health ministry adviser, Reuters news agency reports.
"It's their right to have the body of their relative," he added.
The Taleban have said they will kill the hostages if the body of their former commander is not handed over.
The BBC's Charles Haviland in Kabul says the Taleban have not guaranteed to free any of the hostages even if the body is collected.
Mullah Dadullah, who lost a leg fighting Soviet forces, is alleged to have orchestrated numerous Taleban suicide attacks and beheadings.
He was killed in a US-led military operation in Helmand province and buried in an undisclosed location.
"We hope that they will release our workers safe and secure," Mr Fahim said. "Now it is up to local authorities in Kandahar... to hand over the body [to the family]," he said.
Correspondents say it is not immediately clear when the swap will be made.
In March there was outrage in Afghanistan and international condemnation of President Karzai after his government made a deal made with the Taleban to secure the release of a kidnapped Italian journalist, Daniele Mastrogiacomo.
The government's critics at home said it was too easily bowing to enemy demands, and that it was putting the plight of a foreigner above that of Afghans who were kidnapped along with the journalist.
In April, an Afghan journalist kidnapped with the Italian was killed by the Taleban. Their driver was beheaded in March.
The US and UK said that the release of five militants in exchange for Mr Mastrogiacomo endangered Nato troops and encouraged kidnappings.