Algerian troops stormed a remote gas plant Saturday to end a hostage crisis that killed 23 foreigners and Algerians, seven of them executed by their captors in a final military assault.
Twenty-one hostages died during the siege that began when the Al-Qaeda-linked gunmen attacked the In Amenas facility deep in the Sahara desert at dawn on Wednesday, the interior ministry said.
Thirty-two kidnappers were also killed, and special forces were able to free "685 Algerian workers and 107 foreigners", it said.
Among the dead were an unknown number of foreigners -- including from Britain, France, Romania and the United States -- and many were still unaccounted for.
Japanese engineering firm JGC Corp. said on Sunday that 10 Japanese and seven foreign workers remained unaccounted for, but confirmed the safety of 61 of 78 workers.
The kidnappers led by Algerian Mokhtar Belmokhtar, a former Al-Qaeda commander in North Africa, killed two people on a bus, a Briton and an Algerian, before taking hundreds of workers hostage when they overran the gas plant.
Belmokhtar's "Signatories in Blood" group had been demanding an end to French military intervention against jihadists in neighbouring Mali.
The apparent leader of the commando group warned in a recording broadcast Saturday that he would blow up the factory if the army got too close.
In the audio recording, broadcast by the Mauritanian news agency, Al-Mulathameen Brigade commander Abdul Rahman al-Nigeri of Niger spoke late Thursday as the Algerian military surrounded his fighters' position.
Nigeri was said to be a senior lieutenant to the overall leader of the kidnappers, Belmokhtar.
In Saturday's assault, "the Algerian army took out 11 terrorists, and the terrorist group killed seven foreign hostages", state television said, without giving a breakdown of their nationalities.
A security official who spoke to AFP as army helicopters overflew the plant gave the same death tolls, adding it was believed the foreigners were executed "in retaliation".
As experts began to clear the complex of bombs planted by the perpetrators, residents of In Amenas breathed a collective sigh of relief.
"We went from a peaceful situation to a terror situation," said one resident who gave his name as Fouad.
"The plant could have exploded and taken out the town," said another.
Brahim Zaghdaoui said he was not surprised by the Algerian army's ruthless final assault.
"It was predictable that it would end like that," he said standing outside the town's hospital, where coffins were seen arriving in the morning.
Most of the hostages had been freed on Thursday when Algerian forces launched a rescue operation, which was widely condemned as hasty.
But US President Barack Obama, his French counterpart Francois Hollande and US Defence Secretary Leon Panetta refused to blame Algeria and said responsibility for the deaths lay with the "terrorists".
Obama's remarks were his first direct comments about the hostage crisis.
"The blame for this tragedy rests with the terrorists who carried it out, and the United States condemns their actions in the strongest possible terms," Obama said in a statement.
The attack was a reminder of the threat posed by "Al-Qaeda and other violent extremist groups in North Africa".
"In the coming days, we will remain in close touch with the government of Algeria to gain a fuller understanding of what took place so that we can work together to prevent tragedies like this," Obama added.
The response by Algiers was "the most appropriate" given it was dealing with "coldly determined terrorists ready to kill their hostages", said Hollande.
Panetta said: "They are in the region, they understand the threat from terrorism... I think it's important that we continue to work with (Algiers) to develop a regional approach."
Belmokhtar also wanted to exchange American hostages for the blind Egyptian sheikh Omar Abdul Rahman and Pakistani Aafia Siddiqui, jailed in the United States on charges of terrorist links.
At least one American had already been confirmed dead before Saturday's assault.
But the State Department said "the United States does not negotiate with terrorists".
British Defence Secretary Philip Hammond said the deaths were "appalling and unacceptable and we must be clear that it is the terrorists who bear sole responsibility for it".
Foreign Secretary William Hague said a total of six British nationals and one resident of the United Kingdom were either dead or unaccounted for.
Prime Minister Shinzo Abe of Japan said he had received "severe information" about 10 of his country's nationals who were still missing.
The gunmen said on Friday that they were still holding "seven foreign hostages" -- three Belgians, two Americans, one Japanese and a Briton.
However, Brussels said it had no indication any of its nationals were being held.
A Colombian employee of BP oil is believed to be among the 21 hostages killed at the gas plant, President Juan Manuel Santos said.
The hostage-taking was the largest since the 2008 Mumbai attack, and the biggest by rebels since hundreds were killed in a Moscow theatre in 2002 and at a school in the Russian town of Beslan in 2004, according to monitoring group IntelCenter.
Algeria was strongly criticised for launching Thursday's assault, which the kidnappers said had left dead 34 of the hostages and 15 of their own fighters.
France, which said on Saturday that 2,000 of the 2,500 troops it had pledged were now on the ground in Mali, said that no more of its citizens were being held.
President Hollande said French troops would stay in Mali as long as was needed "to defeat terrorism" in the West African country and its neighbours.
Algerian news agency APS quoted a government official as saying the kidnappers, who claimed to have come from Niger, were armed with machineguns, assault rifles, rocket launchers and missiles.
This was confirmed by an Algerian driver, Iba El Haza, who said the hostage-takers spoke in different Arabic dialects and perhaps also in English.
"From their accents I understood one was Egyptian, one Tunisian, another Algerian and one was speaking English or (another) foreign language," Haza told AFP after escaping on Thursday.
"The terrorists said: 'You have nothing to do with this, you are Algerians and Muslims. We won't keep you, we only want the foreigners.'"