ALGIERS, Algeria (AP) — In a bloody finale, Algerian special forces stormed a natural gas complex in the Sahara desert on Saturday to end a standoff with Islamist extremists that left at least 23 hostages dead and killed all 32 militants involved, the Algerian government said.
With few details emerging from the remote site in eastern Algeria, it was unclear whether anyone was rescued in the final operation, but the number of hostages killed on Saturday — seven — was how many the militants had said that morning they still had. The government described the toll as provisional and some foreigners remain unaccounted for.
The siege at Ain Amenas transfixed the world after radical Islamists linked to al-Qaeda stormed the complex, which contained hundreds of plant workers from all over the world, then held them hostage surrounded by the Algerian military and its attack helicopters for four tense days that were punctuated with gun battles and dramatic tales of escape.
Algeria’s response to the crisis was typical of its history in confronting terrorists, favoring military action over negotiation, which caused an international outcry from countries worried about their citizens. Algerian military forces twice assaulted the two areas where the hostages were being held with minimal apparent mediation — first on Thursday, then on Saturday.
‘‘To avoid a bloody turn of events in response to the extreme danger of the situation, the army’s special forces launched an intervention with efficiency and professionalism to neutralize the terrorist groups that were first trying to flee with the hostages and then blow up the gas facilities,’’ Algeria’s Interior Ministry said in a statement about the standoff.
Immediately after the assault, French President Francois Hollande gave his backing to Algeria’s tough tactics, saying they were ‘‘the most adapted response to the crisis.’’
‘‘There could be no negotiations’’ with terrorists, the French media quoted him as saying in the central French city of Tulle.
Hollande said the hostages were ‘‘shamefully murdered’’ by their captors, and he linked the event to France’s military operation against al-Qaida-backed rebels in neighboring Mali. ‘‘If there was any need to justify our action against terrorism, we would have here, again, an additional argument,’’ he said.
In the final assault, the remaining band of militants killed the hostages before 11 of them were in turn cut down by the special forces, Algeria’s state news agency said. The military launched its Saturday assault to prevent a fire started by the extremists from engulfing the complex and blowing it up, the report added.
A total of 685 Algerian and 107 foreigner workers were freed over the course of the four-day standoff, the ministry statement said, adding that the group of militants that attacked the remote Saharan natural gas complex consisted of 32 men of various nationalities, including three Algerians and explosives experts.
The military also said it confiscated heavy machine guns, rocket launchers, missiles and grenades attached to suicide belts.
Sonatrach, the Algerian state oil company running the Ain Amenas site along with BP and Norway’s Statoil, said the entire refinery had been mined with explosives, and that the process of clearing it out is now under way.
Algeria has fought its own Islamist rebellion since the 1990s, elements of which later declared allegiance to al-Qaida and then set up new groups in the poorly patrolled wastes of the Sahara along the borders of Niger, Mali, Algeria and Libya, where they flourished.
The standoff has put the spotlight on these al-Qaeda-linked groups that roam these remote areas, threatening vital infrastructure and energy interests. The militants initially said their operation was intended to stop a French attack on Islamist militants in neighboring Mali — though they later said it was two months in the planning, long before the French intervention.
The militants, who came from a Mali-based al-Qaida splinter group run by an Algerian, attacked the plant Wednesday morning. Armed with heavy machine guns and rocket launchers in four-wheel drive vehicles, they fell on a pair of buses taking foreign workers to the airport. The buses’ military escort drove off the attackers in a blaze of gunfire that sent bullets zinging over the heads of crouching workers. A Briton and an Algerian — probably a security guard — were killed.
The militants then turned to the vast gas complex, divided between the workers’ living quarters and the refinery itself, and seized hostages, the Algerian government said. The gas flowing to the site was cut off.
Saturday’s government statement said the militants came across the border from ‘‘neighboring countries,’’ while the militants said they came from Niger, hundreds of miles (kilometers) to the south.
On Thursday, Algerian helicopters kicked off the military’s first assault on the complex by opening fire on a convoy carrying both kidnappers and their hostages to stop them from escaping, resulting in many deaths, according to witnesses.
The accounts of hostages who escaped the standoff showed they faced dangers from both the kidnappers and the military.
Ruben Andrada, 49, a Filipino civil engineer who works as one of the project management staff for the Japanese company JGC Corp., described how he and his colleagues were used as human shields by the kidnappers, which did little to deter the Algerian military.
On Thursday, about 35 hostages guarded by 15 militants were loaded into seven SUVs in a convoy to move them from the housing complex to the refinery, Andrada said. The militants placed ‘‘an explosive cord’’ around their necks and were told it would detonate if they tried to run away, he said.
‘‘When we left the compound, there was shooting all around,’’ Andrada said, as Algerian helicopters attacked with guns and missiles. ‘‘I closed my eyes. We were going around in the desert. To me, I left it all to fate.’’
Andrada’s vehicle overturned allowing him and a few others to escape. He sustained cuts and bruises and was grazed by a bullet on his right elbow. He later saw the blasted remains of other vehicles, and the severed leg of one of the gunmen.
The site of the gas plant spreads out over several hectares (acres) and includes a housing complex and the processing site, about a mile (1.6 kilometers) apart, making it especially complicated for the Algerians to secure the site and likely contributed to the lengthy standoff.
‘‘It’s a big and complex site. It’s a huge place with a lot of people there and a lot of hiding places for hostages and terrorists,’’ said Col. Richard Kemp, a retired commander of British forces who had dealt with hostage rescues in Iraq and Afghanistan. ‘‘These are experienced terrorists holding the hostages.’’
While the Algerian government has only admitted to 23 hostages dead so far, the militants claimed through the Mauritanian news website ANI that the helicopter attack alone killed 35 hostages.
One American, from Texas, is among the dead.
French Defense Minister Jean-Yves Le Drian said Saturday that a Frenchman killed, Yann Desjeux, was a former member of the French special forces and part of the security team. The remaining three French nationals who were at the plant are now free, the Foreign Ministry said.
The British government said Saturday it is trying to determine the fate of six people from Britain who are either dead or unaccounted for.
Prime Minister David Cameron of Britain said, ‘‘There is no justification for taking innocent life in this way. Our determination is stronger than ever to work with allies right around the world to root out and defeat this terrorist scourge and those who encourage it.’’
The Norwegian government said there were five Norwegians unaccounted for.
Romanian Prime Minister Victor Ponta said Saturday one Romanian hostage was killed in the course of the siege, while the Malaysian government said two of its citizens were still missing.
The attack by the Masked Brigade, founded by Algerian militant Moktar Belmoktar, had been in the works for two months, a member of the brigade told the ANI news outlet. He said militants targeted Algeria because they expected the country to support the international effort to root out extremists in neighboring Mali and it was carried out by a special commando unit, ‘‘Those Who Signed in Blood,’’ tasked with attacking nations supporting intervention in Mali.
The kidnappers focused on the foreign workers, largely leaving alone the hundreds of Algerian workers who were briefly held hostage before being released or escaping.
Several of them arrived haggard-looking on a late-night flight into Algiers on Friday and described how the militants stormed the living quarters and immediately separated out the foreigners.
Mohamed, a 37-year-old nurse who like the others wouldn’t allow his last name to be used for fear of trouble for himself or his family, said at least five people were shot to death, their bodies still in front of the infirmary when he left Thursday night.
Chabane, an Algerian who worked in food services, said he bolted out the window and was hiding when he heard the militants speaking among themselves with Libyan, Egyptian and Tunisian accents. At one point, he said, they caught a Briton.
‘‘They threatened him until he called out in English to his friends, telling them, ‘Come out, come out. They’re not going to kill you. They’re looking for the Americans,'’’ Chabane said.
‘‘A few minutes later, they blew him away.’’
Paul Schemm reported from Rabat, Morocco. Associated Press writers Aomar Ouali in Algiers; Oliver Teves in Manila, Philippines; Elaine Ganley in Paris; Sylvia Hui in London, and Jan M. Olsen in Copenhagen contributed to this report.