ALGIERS, Algeria (AP) ? The hostage-taking at a remote Algerian gas plant was carried out by 30 militants from across the northern swath of Africa and two from Canada, authorities said. The militants, who wore military uniforms and knew the layout, included explosives experts who rigged it with bombs and a leader whose final order was to kill all the captives.
The operation also had help with inside knowledge ? a former driver at the plant, Algeria's prime minister said Monday.
In all, 38 workers and 29 militants died, the Algerian prime minister said Monday, offering the government's first detailed account of four days of chaos that ended with a bloody military raid he defended as the only way possible to end the standoff. Five foreigners are still missing.
"You may have heard the last words of the terrorist chief," Algerian Prime Minister Abdelmalek Sellal told reporters. "He gave the order for all the foreigners to be killed, so there was a mass execution, many hostages were killed by a bullet to the head."
Monday's account offered the first Algerian government narrative of the standoff, from the moment of the attempted bus hijacking on Wednesday to the moment when the attackers prepared Saturday to detonate bombs across the sprawling complex. That's when Algerian special forces moved in for the second and final time.
All but one of the dead victims ? an Algerian security guard ? were foreigners. The dead hostages included seven Japanese workers, six Filipinos, three energy workers each from the U.S. and Britain, two from Romania and one worker from France.
The prime minister said three attackers were captured but did not specify their nationalities or their conditions or say where they were being held.
He said the Islamists included a former driver at the complex from Niger and that the militants "knew the facility's layout by heart." The vast complex is deep in the Sahara, 800 miles (1,300 miles) south of Algiers, with a network of roads and walkways for the hundreds of workers who keep it running.
The attackers wore military uniforms, according to state television, bolstering similar accounts by former hostages that the attackers didn't just shoot their way in.
"Our attention was drawn by a car. It was at the gate heading toward the production facility. Four attackers stepped out of a car that had flashing lights on top of it," one of the former hostages, Liviu Floria, a 45-year-old mechanic from Romania, told The Associated Press.
The militants had said during the standoff that their band included people from Canada, and hostages who had escaped recalled hearing at least one of the militants speaking English with a North American accent.
The Algerian premier said the Canadians were of Arab descent. He further said the militant cell also included men from Egypt, Mali, Niger, Mauritania and Tunisia, as well as three Algerians. Officials in Canada could not confirm that any of the attackers were from there.
"The announcement of the Algerian prime minister is fine, but we need verification. It could be a forged document. We need to confirm," said a Canadian official who was not authorized to speak publicly and requested anonymity.
Three Americans died in the attack and seven made it out safely, a U.S. official in Washington said, speaking on condition of anonymity because he was not authorized to speak publicly. The bodies have been recovered, the official said.
An earlier report from an Algerian security official that as many as 80 people had died in the assault ? including hostages and attackers ? appears to have overstated the toll, but the official had cautioned that many bodies discovered during a sweep of the facility were badly disfigured, making it difficult to reach a total.
Algeria has not reported any military deaths from four days of confronting the fighters. Algerian authorities are typically reluctant to announce military losses.
The attack began early Wednesday with the attempted hijacking of two buses filled with workers outside the complex. Repelled by Algerian forces, the militants moved on the main complex, armed with missiles, mortars and bombs for their three explosives experts, said Prime Minister Sellal. They split into two groups, with one infiltrating the complex's living quarters and the other the gas plant.
Sellal praised the quick wits of a guard who tripped an alarm that stopped the flow of gas and warned workers of an imminent attack.
"It was thanks to him that the factory was protected," he said.
Floria, the former hostage from Romania, remembered the moment when the power was cut.
"I ran together with other expats and hid under the desks in my office, locking the door. Attackers went scanning the office facility kicking the doors in. Luckily our door did not break and they went on to other offices," he said. "Locals were freed, the attackers made clear from the beginning that only foreigners were a target. Expats were detained."
Ultimately, Floria escaped. But not before he heard the two gunshots that silenced a pair of wounded hostages he said he tried to save.
"The perception of time changes. Seconds become hours. You feel you are losing your mind. I went through this for almost 40 hours," he said.
The prime minister said the heavily armed militants had prepared the attack for two months. He said the attackers arrived from northern Mali and had planned to return there with the foreign hostages. Seven French citizens taken hostage in recent years are thought to be held by al-Qaida linked groups in northern Mali.
Sellal justified the helicopter attack Thursday on vehicles filled with hostages out of the fear the kidnappers were attempting to escape.
In a statement, the Masked Brigade, the group that claimed to have masterminded the takeover, has warned of more such attacks against any country backing military intervention in neighboring Mali, where the French are trying to stop an advance by Islamic extremists. Algeria, despite its government's reservations about the French decision, is allowing French jets to overfly.
Col. Thierry Burkhard, the French military spokesman, said he did not know if militants in Mali were aware of the events in Algeria.
"However, I'm convinced the terrorist groups in the field have radios, so there's a strong chance that they're not only up to date with what's happening in Algeria but they're listening to everything that Western journalists are saying about the deployment of different forces in the field," he said.
The militants' operation was led by an Algerian, Amine Benchenab, who was known to security services and was killed during the assault, Burkhard added.
Moktar Belmoktar, who is believed to have orchestrated the attack, said in a statement over the weekend that the Algerian site was chosen after the country opened its airspace.
Sellal said negotiating was essentially impossible.
"Their goal was to kidnap foreigners," he said. "They wanted to flee to Mali with the foreigners, but once they were surrounded they started killing the first hostages."
He said the assault by Algerian special forces on the plant on Saturday that killed the last group of militants and hostages came after the kidnappers attempted to destroy the complex: "They led us into a real labyrinth, in negotiations that became unreasonable."
Associated Press reporters Paul Schemm in Rabat, Morocco, Lori Hinnant and Sarah DiLorenzo in Paris, Bradley Klapper in Washington, Rob Gillies in Toronto, and Nicolae Dumitrache and Vadim Ghirda in Pitesti, Romania, contributed to this report.