The militants declared that the takeover was prompted by France's attacks on al-Qaida-linked rebels in Mali, and they demanded that the intervention end or the hostages would pay for it.
The takeover soon turned into a standoff as military units from a nearby base surrounded the complex.
On Wednesday night, Kabila, Algeria's top security official, announced that in accordance to Algeria's longstanding policy, "we reject all negotiations with the group." Despite regular elections, Algeria is run by a coterie of generals and ruling party leaders who got the country through a bloody, decade-long Islamist rebellion with brutal tactics that earned them the nickname "the eradicators."
On Thursday afternoon, Algerian military forces saw a five-jeep convoy moving from one part of the complex to another. Fearing the kidnappers were trying to make a break for it, they sent attack helicopters into action.
Irish electrician Stephen McFaul was in that convoy and made it out alive as the world exploded around him.
"Four of the jeeps were taken out and everybody in them was killed," McFaul's brother, Brian, told the Irish Times. "The jeep my brother was in crashed and my brother made break for it," with a belt of explosives strapped around his neck.
The kidnappers called the Mauritanian news service ANI to say that 35 hostages and 15 of their fighters had been killed in the bloodbath — a figure that was impossible to confirm. The kidnappers told ANI that they were just trying to consolidate hostages into a single location when the Algerians attacked.
On Friday, it became clear the Algerian forces had retaken only the living quarters. Hostages and their kidnappers remained ensconced in the refinery.
An international outcry mounted over the Algerians' handling of the crisis. Experts noted that this is how they have always dealt with terrorists.
"It's the Russian training for dealing with terrorism," said Matieu Guidere, a longtime expert on al-Qaida and Algeria. "The message is: We will terrorize the terrorists. ... This is clear. The life of hostages is nothing in the balance."
The Algerian government insisted it had to intervene to prevent a catastrophe.
"As European counterterrorism experts have emphasized, no operation to liberate hostages carried out in such exceptionally complex conditions can succeed 100 percent without some damage," a security official, speaking on condition of anonymity because he was not authorized to discuss the sensitive operation, told the state news agency.
In Washington, the Obama administration said it was trying to secure the release of Americans held by the militants. It would not say how many there were.
Secretary of State Hillary Rodham Clinton defended Algeria.
"Let's not forget: This is an act of terror," she said. "The perpetrators are the terrorists. They are the ones who have assaulted this facility, have taken hostage Algerians and others from around the world as they were going about their daily business."
Schemm reported from Rabat. Associated Press writers Sarah DiLorenzo and Elaine Ganley in Paris and Shawn Pogatchnik in Dublin, Ireland, contributed to this report.
Copyright 2013 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.