ALGIERS, Algeria — In a desert standoff deep in the Sahara, the Algerian army ringed a natural gas complex where Islamist militants hunkered down with dozens of hostages Wednesday night after a rare attack that appeared to be the first violent shock wave from the French intervention in Mali.

A militant group that claimed responsibility said 41 foreigners, including seven Americans, were being held after the assault on one of oil-rich Algeria's energy facilities, 800 miles from the capital, Algiers. Two foreigners were killed.

The group claiming responsibility said the attack was revenge for Algeria's support of France's military operation against al-Qaida-linked rebels in neighboring Mali. Defense Secretary Leon Panetta called it a "terrorist act."

The militants appeared to have no escape, with troops surrounding the complex and army helicopters clattering overhead.

The group — called Katibat Moulathamine, or the Masked Brigade — phoned a Mauritanian news outlet to say one of its affiliates had carried out the operation at the Ain Amenas gas field, and that France should end its intervention in Mali to ensure the safety of the hostages.

BP, the Norwegian company Statoil and the Algerian state oil company Sonatrach operate the gas field. A Japanese company, JGC Corp., provides services for the facility as well.

In Washington, State Department spokeswoman Victoria Nuland confirmed that "U.S. citizens were among the hostages."

In Rome, Panetta said the United States "will take all necessary and proper steps" to deal with the attack.

Algeria's top security official, Interior Minister Daho Ould Kabila, said one Briton and one Algerian were killed in the attack, while a Norwegian and two other Britons were among the six wounded.

"We reject all negotiations with the group," Kabila said on national television, raising the specter of a possible armed assault to try to free the hostages.

Wednesday's attack began with an ambush on a bus carrying employees from the massive gas plant to the nearby airport, but the attackers were driven off, according to the Algerian government, which said three vehicles of heavily armed men were involved.

"After their failed attempt, the terrorist group headed to the complex's living quarters and took a number of workers with foreign nationalities hostage," the government said in a statement.