A top Al Qaeda leader in Yemen on Thursday blamed U.S. President Obama for the recent deaths of two hostages, an American and a South African, in a failed rescue operation.

Nasr bin Ali al-Ansi's video message, posted on one of the group's Twitter accounts, is its first comment since Luke Somers and Pierre Korkie were killed when U.S. special forces attacked an Al Qaeda safe house attempting to rescue the pair.

Al-Ansi said he warned the U.S. against such attempts after a first rescue operation in November failed. He accused Obama of recklessness, and said the raid "caused things to go in a completely different way than we wanted."

Obama said he ordered the raid because Somers, a 33-year-old journalist, was believed to be in "imminent danger." The president condemned Somers' killing as a "barbaric murder."

U.S. officials said that about 40 American special forces were involved in the rescue attempt, which followed U.S. drone strikes in the area. The rescuers, backed by Yemeni ground forces, advanced within 110 yards of the compound in Shabwa province when they were spotted by the militants. A firefight ensued, and the raid was over in about 30 minutes, they said.

Al-Ansi described the rescue operation as an "execution order" and that poorly equipped militants fended off heavily armed US forces for nearly three hours.

Initial Al Qaeda demands were never clear. Al-Ansi on Thursday claimed that Al Qaeda wanted to negotiate the release of detainees held at Guantanamo Bay. He also mentioned Sheik Omar Abdel-Rahman, known as the "Blind Sheik", who is serving a life sentence in the United States on a terrorism conviction.

"They could have at least negotiated with us about some clauses or show sincerity," he added.

Al-Ansi also warned that Al Qaeda would continue to "put the lives of all Americans in danger inside and outside of America ... in the air, on the ground and in the sea."

Washington considers Al Qaeda in the Arabian Peninsula to be the most dangerous affiliate of the terror group founded by Usama bin Laden. The group has been linked to several sophisticated plots to attack the U.S. homeland that were either botched or foiled.

With the permission of Yemen's government, the U.S. has for years launched drone strikes against militant targets in the country and provided Yemen with hundreds of millions of dollars in security assistance. Civilian casualties from the drone strikes have stoked anger.

Hours before the release of the video, the group said that it shelled a Yemeni air base used by U.S. forces. It was not immediately clear if there were casualties.