Al Qaeda-affiliated militants executed hostage journalist Luke Somers Friday after a captor spotted American commandos who were attempting a rescue mission, a report said. A second hostage, South African teacher Pierre Korkie, was also killed in the failed attempt.

A militant was reportedly relieving himself when he spotted American forces entering the compound in Yemen, a counterterrorism official told ABC News. The special forces soldiers engaged in a firefight with militants during which both Somers and Korkie were shot and severely wounded.

“There is zero possibility that the hostages were victims of a crossfire,” an unnamed military official said. “This was an execution.”

The American commandos were within 100 yards of Somers’ location when they were discovered, the Wall Street Journal reported. No member of the approximately 40-person U.S. task force was injured, but six militants were killed.

President Barack Obama and Defense Secretary Chuck Hagel approved the rescue mission -- the second in recent days -- after Somers’ captors threatened Wednesday to kill him unless their demands were met, Fox News reported. Both Somers and Korkie were alive and received medical attention aboard helicopters as the commando unit left the compound, but neither could be saved.

"The United States strongly condemns the barbaric murder of Luke Somers at the hands of Al Qaeda terrorists during a rescue operation conducted by U.S. forces in Yemen," Obama said in a statement. “Earlier this week, a video released by his terrorist captors announced that Luke would be killed within 72 hours. Other information also indicated Luke's life was in imminent danger. Based on this assessment, and as soon as there was reliable intelligence and an operational plan, I authorized a rescue attempt yesterday."

Yemen President Abd Rabbuh Mansur Hadi was aware of the operation. However, Yemen’s military did not assist the United States in conducting the raid, according to a military official.