The Algerian army carried out a dramatic final assault to end a siege by Islamic militants at a desert gas plant on Saturday, killing 11 al Qaeda-linked gunmen after they took the lives of seven more foreign hostages, the state news agency said.
The state oil and gas company, Sonatrach, said the militants who attacked the plant on Wednesday and took a large number of hostages had booby-trapped the complex with explosives, which the army was removing.
"It is over now, the assault is over, and the military are inside the plant clearing it of mines," a source familiar with the operation told Reuters.
British Defense Secretary Philip Hammond said the hostage situation had been "brought to an end" by the Algerian army assault on the militants.
The exact death toll among the gunmen and the foreign and Algerian workers at the plant near the town of In Amenas remained unclear, although a tally of reports from various sources indicated that several dozen people had been killed.
The Islamists' attack on the gas plant has tested Algeria's relations with the outside world, exposed the vulnerability of multinational oil operations in the Sahara and pushed Islamic radicalism in northern Africa to center stage.
Some Western governments expressed frustration at not being informed of the Algerian authorities' plans to storm the complex. Algeria's response to the raid will have been conditioned by the legacy of a civil war against Islamist insurgents in the 1990s which claimed 200,000 lives.
As the army closed in, 16 foreign hostages were freed, a source close to the crisis said. They included two Americans and one Portuguese. Britain said fewer than 10 of its nationals at the plant were unaccounted for and it was urgently seeking to establish the status of all Britons caught up in the crisis.
BP's chief executive Bob Dudley said on Saturday four of its 18 workers at the site were missing. The remaining 14 were safe.
The crisis at the gas plant marked a serious escalation of unrest in northwestern Africa, where French forces have been in Mali since last week fighting an Islamist takeover of Timbuktu and other towns.
The captors said their attack on the Algerian gas plant was a response to the French offensive in Mali. However, some U.S. and European officials say the elaborate raid probably required too much planning to have been organized from scratch in the week since France launched its strikes.
Scores of Westerners and hundreds of Algerian workers were inside the heavily fortified gas compound when it was seized before dawn on Wednesday by Islamist fighters who said they wanted a halt to the French intervention in neighboring Mali.
Hundreds escaped on Thursday when the army launched a rescue operation, but many hostages were killed.
Before the final assault, different sources had put the number of hostages killed at between 12 and 30, with many foreigners still unaccounted for, among them Norwegians, Japanese, Britons, and Americans.
The figure of 30 came from an Algerian security source, who said eight Algerians and at least seven foreigners were among the victims, including two Japanese, two Britons, and a French national. One British citizen was killed when the gunmen seized the hostages on Wednesday.
The U.S. State Department said on Friday one American, Frederick Buttaccio, had died, but gave no further details.
U.S. Defense Secretary Leon Panetta said nobody was going to attack the U.S. and get away with it.
"We have made a commitment that we're going to go after al Qaeda wherever they are and wherever they try to hide," he said during a visit to London. "We have done that obviously in Afghanistan, Pakistan, we've done it in Somalia, in Yemen and we will do it in North Africa as well."
Earlier on Saturday, Algerian special forces found 15 unidentified burned bodies at the plant, a source told Reuters.
The field commander of the group that attacked the plant is a fighter from Niger called Abdul Rahman al-Nigeri, according to Mauritanian news agencies. His boss, Mokhtar Belmokhtar, a veteran of fighting in Afghanistan in the 1980s and Algeria's civil war of the 1990s, appears not to have joined the raid.
Britain, Japan, and other countries have expressed irritation that the army assault was ordered without consultation and officials grumbled at the lack of information.
But French President Francois Hollande said the Algerian military's response seemed to have been the best option given that negotiation was not possible.
"When you have people taken hostage in such large number by terrorists with such cold determination and ready to kill those hostages — as they did — Algeria has an approach which to me, as I see it, is the most appropriate because there could be no negotiation," Hollande said.
The apparent ease with which the fighters swooped in from the dunes to take control of an important energy facility, which produces some 10 percent of the natural gas on which Algeria depends for its export income, has raised questions over the value of outwardly tough Algerian security measures.
Algerian officials said the attackers may have had inside help from among the hundreds of Algerians employed at the site.
Security in the half-dozen countries around the Sahara desert has long been a preoccupation of the West. Smugglers and militants have earned millions in ransom from kidnappings.
The most powerful Islamist groups operating in the Sahara were severely weakened by Algeria's secularist military in the civil war in the 1990s. But in the past two years the regional wing of al Qaeda gained fighters and arms as a result of the civil war in Libya, when arsenals were looted from Muammar Gaddafi's army.
France says the hostage incident proves its decision to fight Islamists in neighboring Mali was necessary. Al Qaeda-linked fighters, many with roots in Algeria and Libya, took control of northern Mali last year.