SANAA, Yemen (AP) — An American photojournalist and a South African teacher are dead after a high-risk, U.S.-led raid to free them from al-Qaida-affiliated militants in Yemen went awry.

The pre-dawn raid was the second rescue attempt in as many weeks to free Luke Somers, a 33-year-old freelance photographer and editor kidnapped just over a year ago in Yemen's capital.

President Barack Obama says he ordered the raid because Somers was believed to be in "imminent danger."

South African Pierre Korkie, abducted 18 months ago, also was killed by militants as U.S. forces descended upon the militants' compound in southern Yemen. A South African aid group says he was a day from freedom after a deal late last month that included a "facilitation fee" to the kidnappers.

U.S. officials say about 40 American special operations forces, backed by Yemeni troops, were involved in the operation. But they were spotted by the militants. A firefight ensued.

U.S. forces saw a militant briefly enter a building on the compound. It was then that the U.S. believes the militants shot Somers and Korkie. Both men were found alive, but gravely wounded.