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.