An attack on a remote natural gas complex in the Sahara desert was conducted by an international band of Islamist militants, apparently including two Canadians, who wore Algerian army uniforms and had help from the inside, Algeria’s prime minister said Monday, in his government’s first official accounting of the bloody four-day siege.

Three Americans died in the violence and seven U.S. citizens survived, the State Department said Monday.

The Algerian government captured three of the militants alive, Prime Minister Abdelmalek Sellal told reporters in Algiers, in remarks carried by the state-run news agency. The carefully planned attack, which he said was two months in the making, targeted foreign workers at the complex and included assistance by a militant from Niger who formerly worked at the site as a driver. The attackers appeared to know the layout of the sprawling facility by heart, Sellal said.

The prime minister said 38 hostages and 29 militants died during the takeover and subsequent recapture of the complex at Tiguentourine near Algeria’s eastern border with Libya. Only one of the dead hostages was Algerian; the rest were foreigners from at least seven countries, he said. Five other foreign workers remain unaccounted for, Sellal said.

The State Department confirmed last week that one American, Frederick Buttaccio, a resident of Katy, Tex., who worked for the British energy giant BP, had died at the complex. Department spokeswoman Victoria Nuland said Monday that two other Americans — Victor Lynn Lovelady and Gordon Lee Rowan — also died in the attack. The department did not release details about the victims.

Rep. Greg Walden (R-Ore.) said in a statement Monday that Rowan, 59, lived with his family in Sumpter, Ore. Attempts to reach the Rowan family were unsuccessful.

Lovelady, 58, was married and had two children. He lived in Nederland, Tex. A woman who answered the telephone at his brother’s house said the family would issue a statement Tuesday.

“The blame for this tragedy rests with the terrorists who carried it out, and the United States condemns their actions in the strongest possible terms,” Nuland said. “We will continue to work closely with the government of Algeria to gain a fuller understanding of the terrorist attack of last week and how we can work together moving forward to combat such threats in the future.”

Confusion persists

The Algerian prime minister’s account failed to resolve some of the confusion still surrounding the hostage crisis, and the final death toll — as well as when and how the hostages died — remained unclear.

Sellal said that the heavily armed militants first attempted to seize workers from a bus being driven away from the residential area of the complex but that guards repelled them. The attackers appeared to be trying to escape with hostages on Thursday when Algerian military helicopters bombarded a number of vehicles with missiles to prevent them from speeding away, he said.

The militants denied that they were trying to flee with hostages and said they were transporting the captives to a safer area, a Mauritanian news agency that made contact with the group reported last week.

Other statements attributed to the militants suggested that they were interested in negotiating. But Sellal defended his country’s swift and harsh response to the situation. He said the group had been making increasingly unreasonable demands and was preparing to blow up the gas plant when government forces stormed the complex Saturday, bringing the hostage crisis to a decisive and violent end.

Sellal said the militants came from Algeria, Mali, Mauritania, Niger, Egypt, Tunisia and Canada. He said they initially gathered in northern Mali, where Islamist rebels have captured a vast swath of territory, then entered Algeria from Libya. The attack was coordinated by one of the Canadians, Sellal said. It was not clear whether the Canadians were among those who were killed or captured.

“Their goal was to kidnap foreigners,” he said.

If his account is accurate, the Tigentourine assault would represent the latest fallout from the regional destabilization that followed the 2011 ouster of longtime Libyan leader Moammar Gaddafi. Weapons and fighters from that conflict have flooded northern Africa, contributing to the Islamist successes in carving out a haven in northern Mali and bolstering the strength of al-Qaeda in the Islamic Maghreb, a regional umbrella organization that has been tied to the attack in Algeria.

‘On Europe’s doorstep’

The emerging details from Algiers came as Western governments portrayed the tragedy as evidence that the threat of al-Qaeda was shifting closer to Europe. British Prime Minister David Cameron told Parliament on Monday that Britain would step up counterterrorism efforts, contributing intelligence and assets to an international effort to find and dismantle the network that planned and carried out the attack.

“The response must be tough, intelligent, patient and based on strong international partnerships,” said Cameron, who confirmed that three Britons had died and that three more were presumed dead, along with a Colombian citizen who was a British resident.

Cameron added: “Together with our partners in the region, we are in the midst of a generational struggle against an ideology which is an extreme distortion of the Islamic faith, and which holds that mass murder and terror are not only acceptable but necessary. We must tackle this poisonous thinking at home and abroad and resist the ideologues’ attempt to divide the world into a clash of civilizations.”

Cameron reiterated that Britain had no intention of sending troops into Mali, where French forces are engaged in ground operations against Islamist extremists who were advancing on the fragile government in the capital, Bamako. But he said London would consider bolstering tactical assistance, providing intelligence and surveillance.

“In Mali, we will work with the Malians themselves, with their neighbors and with our international allies to prevent a new terrorist haven developing on Europe’s doorstep,” Cameron said.

Foreigners targeted

The gas facility, run jointly by BP, Norway’s Statoil and the Algerian state energy company Sonatrach, employed 790 people, including 134 foreigners of 26 nationalities, the state-run Algeria Press Service said.

Among the foreigners dead or missing were workers of American, British, French, Japanese, Norwegian, Philippine and Romanian nationalities, officials said. Japan’s prime minister told reporters Monday that seven Japanese were confirmed dead and that three were unaccounted for, the highest toll among the foreigners at the gas complex. The Philippine Foreign Ministry said that six Filipinos were killed and that four were missing.

According to Mauritania’s private ANI news service, the attack was carried out by the Signatories in Blood battalion, an arm of the Masked Brigade led by Mokhtar Belmokhtar, an Algerian with links to al-Qaeda. In a statement published by ANI, Belmokhtar’s group said the Algerian government had ignored its push for a bargain, calling the harsh crackdown “barbaric.”

Birnbaum reported from Berlin and Faiola from London. William Branigin and Anne Gearan in Washington and Eliza Mackintosh in London contributed to this report.