* Algerian PM: 38 dead civilians, 29 militants killed
* Dead Canadian named as "Chedad" coordinated attack -PM
* Of hostages, 37 foreigners killed; five more still missing
* Three Islamist assailants taken into custody
* Japanese, Filipinos, British, Norwegians among the dead
ALGIERS, Jan 21 Algeria said on Monday it had confirmed the deaths of at least 38 workers, all but one foreign, at the Sahara gas plant its forces stormed two days ago and said the Islamist gunmen had been led by a man with Canadian citizenship.
Named only as Chedad, a surname found among Arabs in North Africa, the Canadian was among 29 assailants from a local al Qaeda group killed during the four-day siege, Algerian Prime Minister Abdelmalek Sellal said. Another three were detained.
Among hostages confirmed dead by their own governments were three Americans, seven Japanese, six Filipinos and three Britons; others from Britain, Norway and elsewhere were listed as unaccounted for. Sellal said 37 foreigners died, of whom seven were unidentified, and a further five were missing.
Though nearly 700 Algerians and 100 other foreigners escaped or were rescued, the apparent ease with which a group could race over the nearby border from lawless Libya and seize a heavily defended and economically strategic facility has raised doubts for investors on the security of Algeria's vital energy sector.
An Algerian security source said investigators pursuing the possibility that the attackers had inside help to map the complex and gain entry were questioning at least two employees.
Claimed by an Algerian al Qaeda leader as a riposte to France's attack on his allies in neighbouring Mali the previous week, the four-day siege also drew global attention to Islamists in the Sahara and Sahel regions and brought pledges of support to African governments from Western powers whose toppling of Libya's Muammar Gaddafi helped flood the region with weapons.
Sellal, whose government ruled out negotiation with the hostage-takers from the start, vowed that Algeria, scarred by a bitter civil war against Islamists in the 1990s, would prevent the rise of an Afghan-style power base for al Qaeda in the south - there would be no "Sahelistan", he told a news conference.
Prime Minister David Cameron told parliament in London that Britain would increase its help to Algeria's intelligence and security forces and might do more for France in Mali, though he ruled out sending many of its stretched armed forces to Africa.
Noting a shift in the source of threats to British interests from Afghanistan to Africa, he also noted Sellal's rundown of a multinational group of assailants and said the region was becoming "a magnet for jihadists".
Alongside a "strong security response", however, he called for efforts to address long-standing grievances, such as poverty and political exclusion, which foster support for violence. Some militants in Algeria want autonomy for the south and complain of domination by an unchanging establishment in Algiers.
DEATH AND SURVIVAL
As Algerian forces combed the Tigantourine plant near the town of In Amenas for explosives and the missing, survivors and the bereaved told tales of terror, narrow escapes and of death.
"The terrorists lined up four hostages and assassinated them, shot them in the head," a brother of Kenneth Whiteside told Sky News, in an account of the Briton's death given to the family by an Algerian colleague who witnessed it. "Kenny just smiled the whole way through. He'd accepted his fate."
Filipino survivor Joseph Balmaceda said gunmen used him for cover: "Whenever government troops tried to use a helicopter to shoot at the enemy, we were used as human shields."
A Frenchman man hid for more than a day under his bed as jihadist fighters searched the residential complex.
Another Briton, Garry Barlow, called his wife from within the site before he was killed and said: "I'm sat here at my desk with Semtex strapped to my chest."
Several hostages died on Thursday when Algerian helicopters blasted jeeps in which the militants were trying to move them.
Others were able to flee: "We cut the wire with clippers and ran for it, all together, about 50 of us," one told the Times.
A Romanian said he walked 30 km (20 miles) across the desert with little water before running into an Algerian police patrol.
Citizens of nine countries including Algeria died, Sellal said, among them seven Japanese, six Filipinos, two Romanians, an American, a Frenchman and four Britons. Washington later name three dead Americans; Britain said only three Britons were dead but three plus a London-based Colombian were also believed dead.
Norway said the fate of five of its citizens was unclear; in addition to seven Japanese dead, Tokyo said three were missing.
An Algerian security source had earlier told Reuters that documents found on the bodies of two militants had identified them as Canadians: "A Canadian was among the militants. He was coordinating the attack," Sellal said, adding that the raiders had threatened to blow up the gas installation.
That Canadian's name was given only as Chedad. Algerian officials have also named other militants in recent days as having leadership roles among the attackers. Veteran Islamist Mokhtar Belmokhtar claimed responsibility on behalf of al Qaeda.
In a video distributed on the Internet, the one-eyed veteran of Afghan wars of the 1980s, of Algeria's civil war and of the lucrative trans-Sahara cigarette smuggling trade, said: "We in al Qaeda announce this blessed operation."
Dressed in combat fatigues and standing in front of a black Islamist banner, Belmokhtar demanded an end to French attacks on Islamist fighters in Mali. These began five days before the fighters swooped before dawn and seized a plant that produces 10 percent of Algeria's natural gas exports.
U.S. and European officials doubt such a complex raid could have been organised quickly enough to have been conceived as a direct response to the French military intervention. Sellal said it had been two months in the planning. However, French action could have triggered an operation that had already been planned.
It was not clear what evidence the Algerian authorities had for some of their information, including on the nationalities of the attackers; 11 of them, they said, were Tunisian, while only three were Algerian. Others came from Egypt, Mali, Niger and Mauritania, as well as from Canada.
In Ottawa, Canada's foreign affairs department said it was seeking information. Security experts noted that some Canadian citizens had been involved with international militants before.
The jihadists had planned the attack two months ago in neighbouring Mali, Sellal added. They had travelled from there through Niger and Libya, hence evading Algeria's strong security services, until close to In Amenas. Their aim, he said, had been to take foreign hostages to Mali, and they made a first attempt to take captives from a bus near the site early on Wednesday.
He said special forces and army units were deployed against the militants, who had planted explosives in the gas plant with a view to blowing up the facility. Normally producing 10 percent of Algeria's natural gas, it was shut down during the incident.
The government now aims to reopen it this week, although officials at Britain's BP and Norway's Statoil, which operate the plant with Algeria's state energy firm, were less certain.
An Algerian newspaper said they had arrived in cars painted in the colours of state-owned Sonatrach but registered in Libya, a country awash with heavy weaponry since Western powers backed a revolt to bring down Gaddafi in 2011. Using Libya's oil wealth, Gaddafi had exercised a degree of influence in the region and the consequences of his death are still unfolding.
In a sign of the complexities wrought by the Arab Spring revolts, Egypt, a former military dictatorship now led by one of the generals' Islamist foes, criticised France's intervention in Mali on Monday. President Mohamed Mursi called instead for more spending to address rebels' grievances and warned that the military moves would "inflame the conflict in this region".
The bloodshed also added strains to Algeria's long fraught relations with Western powers, where some complained about being left in the dark while the decision to storm the compound was being taken. Algiers portrayed the operation as a success.
And this week, Britain and France both defended the military action by Algeria, the strongest military power in the Sahara and an ally the West needs in combating the militants.
"This would have been a most demanding task for security forces anywhere in the world and we should acknowledge the resolve shown by the Algerians in undertaking it," British Prime Minister Cameron told parliament on Monday.
Chafik Mesbah, a former Algerian presidential security adviser, said: "The West did not criticise Algeria because it knows an assault was inevitable in the circumstances ... The victims were a minimum price to pay to solve the crisis."
Our top photos from the last 24 hours.