US President Barack Obama has condemned the murder of a US hostage by al Qaeda, saying that the terrorist group will "feel the long arm of American justice".
He described as "barbaric" the murder of Luke Somers in Yemen during a rescue attempt by US forces.
"On behalf of the American people, I offer my deepest condolences to Luke's family and to his loved ones," the President said in a statement.
"As this and previous hostage rescue operations demonstrate, the United States will spare no effort to use all of its military, intelligence and diplomatic capabilities to bring Americans home safely, wherever they are located.
"And terrorists who seek to harm our citizens will feel the long arm of American justice," he said.
Obama said he authorised the raid on Friday to rescue Somers and other hostages held in the same location. He said the United States had used every tool at its disposal to secure Somers' release since his capture 15 months ago.
He also thanked the Yemen government for its support.
"Luke was a photojournalist who sought through his images to convey the lives of Yemenis to the outside world," Obama said.
"The callous disregard for Luke's life is more proof of the depths of (al Qaeda in the Arabian Peninsula) AQAP's depravity, and further reason why the world must never cease in seeking to defeat their evil ideology," he said.
Officials said the rescue attempt failed because the captors were alerted to approaching US commandos.
It could have been something as simple as a barking dog that alerted the al Qaeda guards as US special operations forces approached the compound just after midnight. Within seconds, as they neared the building, intense gunfire erupted.
Those details and others provided by US and Yemeni officials about what they describe as Saturday's execution of American photo journalist Luke Somers and South African teacher Pierre Korkie in Yemen illustrate the formidable odds the United States faces in retrieving hostages from the hands of militants across the region.
"There is nothing to indicate what or how these guys knew the team was about to enter the compound," said one US official, speaking on condition of anonymity.
US Secretary of State John Kerry and a Yemeni intelligence official said Somers, 33, and Korkie, 56, were shot by their captors shortly after the raid began in the arid Wadi Abadan district of Shabwa, a province in southern Yemen long seen as one of al Qaeda's most formidable strongholds.
The operation, the second attempt to free Somers in 10 days, began with about 40 US commandos late Friday in Dafaar, a small village. No Yemenis were involved in the raid, a US defence official said.
The commandos arrived on tilt-rotor CV-22 Ospreys, which can fly like an airplane and land like a helicopter. Once on the ground, they approached the compound on foot. A barking dog may have given them away, but that remained unclear, an official said.
As they approached, they "lost the element of surprise," the official said.
A fierce gunfight erupted.
"The enemy started firing erratically and then our guys returned fire," one US official said.
The commandos were less than 100 meters (330 ft) from the compound at that point.
They shot and killed about 10 people, including al Qaeda guards and some civilians, said Ali al-Ahmadi, Chief of Yemen National Security Bureau. The Pentagon said it was unaware of any civilian casualties.
As they fought, an al Qaeda guard darted inside the compound and then exited through the back. Gunfire was heard. That's when American officials believe Somers and Korkie were killed.
With al Qaeda guards wounded or dead, US commandos moved into the compound. They found the hostages with multiple gunshot wounds and carried them to a waiting Osprey, where they were treated. One of the hostages died in the aircraft, the other died once they landed on a nearby assault ship.
The raid lasted just five to 10 minutes.
The operation was pulled together quickly.
Late on Thursday, Pentagon officials told the White House they had drafted a plan for the mission. It was reviewed at the White House the next morning and signed off first by Secretary of Defence Chuck Hagel and then by President Barack Obama, who authorised the mission based on information from the military, law enforcement and the intelligence community.
"We were working against a timeline, which was al Qaeda's public threat to execute Luke Somers within 72 hours," one senior administration official said. "It was our assessment that that clock would run out on Saturday."
US officials said the mission had the support of Yemeni President Abd-Rabbu Mansour Hadi.
The raid was the third failed rescue attempt of an American hostage in five months and followed a November 25 mission that was unsuccessful because Somers had been moved before US commandos arrived.
In that raid, US commandos and Yemeni troops swooped before dawn into a cave in the eastern province of Hadramout and freed eight people.
Seven of the eight turned out to be al Qaeda members who had been held captive by the militants on suspicion of being government spies, two senior Yemeni officials told Reuters. The eighth was a Yemeni computer specialist, they said.
Al-Ahmadi, Chief of Yemen National Security Bureau, said after the seven were freed they told Yemen authorities they were members of al Qaeda in the Arabian Peninsula (AQAP), the militant network's arm in the country, and that they had been accused by their own organisation of spying for the government.
They were detained by AQAP "not as hostages but as suspects," a senior Yemini security official said.
Reuters could not independently confirm his description of those being detained. American officials declined to address the question. Officials at the White House and Pentagon did not respond to requests by Reuters for comment.
The seven - five Yemenis, a Saudi and an Ethiopian - are now being held by Yemen's government, the officials said. It is unclear if the United States was aware that al Qaeda members suspected of being government informants were among the people rescued in that raid.
The raid, along with Saturday's mission and a failed attempt to rescue American journalist James Foley in July, have raised questions over the quality of intelligence used by Washington in attempts to free American hostages.
The November 25 raid in a mountainous region near the Saudi Arabian border lasted just three minutes, the senior Yemeni security official said.
It is uncertain if al Qaeda learned of plans for the November raid in advance and exactly when Somers, who was kidnapped in Yemen's capital Sanaa in September 2013, was moved from the cave in Hadramout.
Those who were freed said Somers and four others were moved 11 hours before the US commandos arrived, the Yemeni security official said. But a senior US official told Reuters that Somers and the others were taken out of the cave either on November 20 or 21, before the Pentagon had even approved the operation.
At the time, US officials thought he was still in the cave, the American official said.