U.S. Special Forces members got within about 100 meters of the Yemen compound in which al Qaeda affiliates were holding American hostage Luke Somers before his captors discovered them and foiled the raid, Defense Department officials said Saturday.

The rescue mission was the second in recent weeks and an eleventh-hour attempt to save Somers, following a threat late Wednesday by al Qaeda Arab Peninsula, backed by intelligence reports, that he would be killed on Saturday morning unless unspecified demands were met.

Defense officials said the team of roughly 40 U.S. commandos touched down in Osprey helicopters about 10 kilometers from the new hostage site, then continued on foot across rugged terrain under the cover of night.

At some point early in the roughly five-to-10-minute firefight, an al Qaeda member apparently went into the holding chamber and shot Somers, 33, and South African Pierre Korkie.

Both were alive and received emergency care from surgeons onboard the V-22 helicopters but neither could be saved, officials said.

One victim died en route to the USS Makin Island and the other died aboard the U.S. warship.

Officials have not said how the U.S. commandos were discovered.

However, none was killed or injured in the mission, which lasted roughly 30 minutes and included rescuing Korkie, a teacher, and Somers, an American photojournalist with duel U.S.-British citizenship.

At least five members of al Qaeda were killed in the fight but none was taken hostage.

The raid, in southern Yemen, was approved on Friday by President Obama and Defense Secretary Chuck Hagel. It started Saturday about 1 a.m. local time (5 p.m. eastern standard time) and was monitored in real time by U.S. officials in Washington and by Hagel who was flying to Kabul, Afghanistan.

Somers, a freelance journalist, was kidnapped just over a year ago in Yemen's capital. The 56-year-old Korkie was abducted 18 months ago in the city of Tazi.

The rescue attempt this weekend followed U.S. drone strikes in the area, U.S. officials said.

There are conflicting reports about whether the raid included support by Yemeni ground forces.

U.S. officials said there was no possibility that Somers or Korkie were struck by American gunfire, based on the location in which they were being held.

The rescue mission follows one on Nov. 25 at a remote al Qaeda safe haven in a Yemen desert region near the Saudi border.

Eight captives, including Yemenis, a Saudi and an Ethiopian, were freed. Somers was not at that location. He and five other hostages had been moved days earlier, officials later said.

Roughly a dozen people are believed held by al Qaeda militants in Yemen.

Korkie was abducted in May 2013 along with his wife, Yolande, who was doing relief work. She was released in January without ransom as a result of negotiations by the South African relief group, Gift of the Givers.

But al Qaeda militants demanded a $3 million ransom for Korkie's release, according to those close to the negotiations.

Somers was kidnapped in September 2013 as he left a supermarket in Sanaa, according to Fakhri al-Arashi, chief editor of the National Yemen, where Somers worked as a copy editor and a freelance photographer during the 2011 uprising in Yemen.

The Associated Press contributed to this report.