US troops in Afghanistan were seconds from rescuing a UK hostage when she was killed by a vest bomb held or worn by a kidnapper, the BBC understands.
They reached the building where Linda Norgrove, 36, was held and were "very, very close" to her, the BBC was told.
It is understood tribal elders negotiating her release asked Nato not to intervene so they had more time.
David Cameron has said it was right for the special forces to try to rescue the aid worker, from Lewis, Western Isles.
The prime minister said: "Decisions on operations to free hostages are always difficult, but where a British life is in such danger, and where we and our allies can act, I believe it is right to try."
BBC correspondent Nicholas Witchell said officials had confirmed Ms Norgrove was killed by an explosion, almost certainly a suicide vest, detonated by one of her captors.
He said: "Local tribal elders up in the area of eastern Afghanistan where she was being held - a very wild, lawless part of this country - had been attempting to persuade her captors to free her.
"And indeed [they] had asked Nato not to intervene militarily so they had time to try to secure her release."
He added that Afghan security officials had become concerned about the group holding Ms Norgrove, as they were extremists with links to al-Qaeda and not from the mainstream Taliban.
"There was concern they might have moved Linda Norgrove across the border into Pakistan, which would have made any rescue operation by Nato completely impossible," he said.
The Nato-led International Security Assistance Force (Isaf) said many people - including the Afghan government and their officials - had done "everything possible" to get the aid worker out.
A spokesman said on Sunday: "The operation realised that she was in grave danger and took the very difficult decision to try and save her life because her life was in great risk at that time."
The failed mission, which involved British officials in an advisory role, was authorised by Foreign Secretary William Hague, with Mr Cameron kept informed.
It is understood US rather than UK special forces were deployed because they had some knowledge of the terrain.
The top US commander in Afghanistan, General David Petraeus, said the troops had done "everything in their power".
He said US troops' thoughts and prayers were with her family during this difficult time.
Ms Norgrove was seized in the province of Kunar on 26 September.
Three local staff were also kidnapped when the two cars they were in were ambushed. The staff were released unharmed last week.
The Briton, who was employed by US aid group DAI, is believed to have been taken by her captors from village to village as British, Afghan and other intelligence agencies searched the remote area.
Ms Norgrove had been based in Jalalabad, where she supervised US-funded reconstruction programmes in the eastern region of Afghanistan.
DAI president James Boomgard said the loss of a "beloved friend and respected colleague" was devastating.
In a statement, he said: "We are saddened beyond words by the death of a wonderful woman whose sole purpose in Afghanistan was to do good."
Ms Norgrove, who had travelled extensively, was an experienced aid worker who had worked in a number of countries.
She worked for the United Nations in Afghanistan and Laos and, prior to that, led a conservation and poverty reduction project in Peru.
DAI carries out aid work, often subcontracted by the United States Agency for International Development.