 -- In the dead of night, a team of U.S. Navy SEALs landed a little more than six miles away from a compound in the Shabwah province of Yemen where U.S. officials believed an affiliate of al Qaeda was holding American journalist Luke Somers captive.

About 110 yards away, after making their way through the rugged terrain on foot, the team of 40 was spotted and the al Qaeda of the Arabian Peninsula (AQAP) fighters began firing wildly at the SEALs, according to a military official. One of the AQAP fighters ran into the compound as the firefight continued outside, then quickly came back out.

When the SEALs secured and entered the compound, they found Somers, 33, and another captive, South African Pierre Korkie, had been shot.

"There is zero possibility that the hostages were victims of cross fire," a military official told ABC News. "This was an execution."

The rescue operation for Somers was the second in the last two weeks, according to U.S. officials, who moved quickly Friday as a deadline by the terrorists to execute him neared. President Obama and Secretary of Defense Chuck Hagel approved it mid-morning Friday.

"The time was short to plan the operation, but it was thorough, and balanced the risks to the special operations forces," the official said.

The 40 SEALs used Air Force CV-22s to land a distance from the compound about 1 a.m. local time Saturday, according to a senior defense official. An AQAP fighter apparently spotted them while relieving himself outside, a counter-terrorism official with knowledge of the operation told ABC News, beginning a firefight that lasted about 10 minutes.

When the SEALs secured the compound, they found Somers and Korkie, 56, inside. They tried transporting them to the USS Makin Island, but one of the men died en route and the other died on the operating table, according to Pentagon officials. The entire operation took 30 minutes.

No American troops were injured in the raid, but six AQAP fighters were killed, U.S. officials said. The operation was pushed ahead after AQAP posted a video online late Wednesday, saying they were going to kill Somers in three days if their demands -- unspecified in the video -- were not met.

No Yemenis were involved in the raid, but the Yemeni government was informed ahead of time.

Somers, who was born in Britain but has American citizenship, was working as a translator for the National Dialogue Conference when he was kidnapped last September.

ABC News' James Gordon Meek contributed to this story.