Militants in the highly-organized operation also wore Algerian army uniforms and appeared to have help from the inside — a man from Niger who had once worked as driver at the plant, he said.
Algeria detailed a grim toll from the attack, saying that 38 hostages and 29 militants died in four days of mayhem. Three of the attackers were captured and five foreign workers remained unaccounted for, Prime Minister Abdelmalek Sellal told reporters at a news conference in Algiers, the capital.
He did not specify the nationalities of the captured militants, report their medical conditions or say where they were being held.
Monday's account offered the first Algerian government narrative of the four-day standoff, from the attempted bus hijacking early Wednesday to the moment when the attackers prepared to explode bombs across the gas plant, which spreads out over 5 square kilometres (2 square miles) deep in the desert, 800 miles (1,300 miles) south of Algiers.
All but one of the dead hostages — an Algerian driver — 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 final death toll was still unclear, since accounts from other governments appeared to indicate that more than five workers were still missing. It was also lower than the 81 estimated Sunday from Algerian reports of dead and missing.
The militants had said during the standoff that their group included Canadians, and hostages who had escaped recalled hearing at least one of the militants speaking English with a North American accent.
In addition to the Canadians, the Algerian prime minister said the militant cell included men from Egypt, Mali, Niger, Mauritania and Tunisia, as well as three Algerians.
Officials in Canada could not immediately confirm whether two of the attackers were citizens.
"Canada condemns in the strongest possible terms this deplorable and cowardly act and all terrorist groups which seek to create and perpetuate insecurity," said Chrystiane Roy, a spokeswoman for the Department of Foreign Affairs.
"We are pursuing all appropriate channels to seek further information and are in close contact with Algerian authorities," she said in a statement.
The Algerian prime minister indicated that this operation was not — as the Islamists had claimed — an immediate reaction to France's recent military intervention against Islamists in neighbouring Mali, since the captured militants said it took two months of planning. But he said the group did come from northern Mali, hundreds of miles away from the gas plant.
He said they included a former driver at the complex from Niger and "knew the facility's layout by heart." They wore Algerian military uniforms, he said, bolstering accounts by escaped hostages that they didn't just shoot their way in.
"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 prime minister said "the last words of the terrorist chief" was to slaughter the hostages.
"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," he said.
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. Their bodies have been recovered, the official said.
Algeria has not reported any military deaths from four days of confronting the fighters.
The attack began early Wednesday with the attempted hijacking of two buses filled with workers outside the complex. Under assault from Algerian forces, the militants moved on the main complex, armed with missiles, mortars and bombs for their three explosives experts, Sellal said.
He praised the quick wits of a guard who set of 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, 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."
Floria ultimately escaped, but not before he heard the two gunshots that killed two wounded foreign hostages that he said he had tried to save.
Sellal said the facility had 790 Algerian workers and 134 foreigners from 26 countries. The Algerians were freed early in the standoff — former hostages said the attackers immediately separated out the foreigners, forcing some to wear explosive belts.
The prime minister said the heavily armed militants came from northern Mali carrying a great deal of explosives and mined the facility.
Sellal justified the Algerian military helicopter attack Thursday on vehicles filled with hostages and Islamists out of the fear that the kidnappers were attempting to escape.
The Algerian special forces assault on the refinery on Saturday that killed the last group of militants and hostages came after the kidnappers attempted to destroy the complex.
The Masked Brigade, the group that claimed to have masterminded the takeover, has warned of more such attacks against any country backing France's military intervention in Mali. Algeria had allowed French planes to fly over its territory to reach Mali.
Sellal said the militants had expected to return to Mali 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.
"Their goal was to kidnap foreigners," Sellal said. "They wanted to flee to Mali with the foreigners but once they were surrounded they started killing the first hostages."
The operation was led by an Algerian, Amine Benchenab, who was known to security services and was killed during the assault, he added. Sellal said negotiating was not impossible.
"They led us into a real labyrinth, in negotiations that became unreasonable," he said.
Norway said five of its citizens from the plant were still unaccounted for, while Japan said three Japanese were still missing. Britain said three citizens and one resident were feared dead but not accounted for. Four Filipinos and two Malaysian plant workers were also missing, according to their governments.
Associated Press reporters Bradley Klapper in Washington, Rob Gillies in Toronto, and Nicolae Dumitrache and Vadim Ghirda in Pitesti, Romania, contributed to this report.Suggest a correction