The crisis culminated in a dramatic final assault by Algerian special forces in which 55 people died. Algerian state news agency APS said foreign hostages were summarily killed as the troops tried to free them.
In a statement last night, the Algerian interior ministry said: "A total of 23 hostages and 32 terrorists have been killed."
Foreign Secretary William Hague said: "We believe that there are five British nationals and one British resident who are either deceased or unaccounted for, in addition to the one fatality that we had already confirmed.
"We are working hard to get definitive information about each individual. We are in touch with all of the families concerned," Hague added, having chaired the second meeting of the day of the Government's Cobra emergencies committee.
Prime Minister David Cameron said he had spoken to Algerian prime minister Abdelmalek Sellal, who confirmed the hostage crisis was "effectively ended".
"I know that the whole country shares my sympathy and concern for everyone who has been caught up in this incident, and for their friends and families," the Prime Minister said in a statement.
"It is our priority now to get people home as quickly as possible and to look after the survivors. Many are already home or on their way back. Our determination is stronger than ever to work with allies right around the world to root out and defeat this terrorist scourge."
The British ambassador to Algiers, Martyn Roper, along with a small consular and political team, travelled to In Amenas, close to the plant, to give consular support.
As the Algerian army closed in yesterday, 16 foreign hostages were freed including two Americans and one Portuguese. Earlier, Algerian special forces found 15 unidentified burned bodies at the plant.
The plant was home to foreign workers from Britain's BP, Norway, Japan and other countries. BP's chief executive Bob Dudley said yesterday that four of its 18 workers at the site were missing. The rest were safe.
First Minister Alex Salmond said eight Scottish residents who had worked at the plant had been confirmed as safe. But he said some of the workers still unaccounted for have family in Scotland or other connections to the country.
Salmond said: "We cannot confirm names and final details on numbers of those hostages with a Scottish connection as this is still an ongoing and changing situation - We will provide full details as soon as we are satisfied that the information is full and final and, most importantly, that families have been informed."
Scores of Westerners and hundreds of Algerian workers were inside the heavily fortified gas compound when it was seized before dawn on Wednesday by Islamist fighters who said they wanted a halt to the French intervention in neighbouring Mali.
Hundreds escaped on Thursday when the army launched a rescue operation, but many were killed.
The commander of the group that attacked the plant is an Islamist fighter from Niger called Abdul Rahman al-Nigeri, according to Mauritanian news agencies. His boss, Mokhtar Belmokhtar, a veteran of fighting in Afghanistan in the 1980s and Algeria in the 1990s, appears not to have joined the raid. His fighters call themselves "Those Who Sign in Blood".
Britain, Japan and other countries have expressed irritation that the Algerian army assault was ordered without consultation.
But French President Francois Hollande said the Algerian military's response seemed to have been the best option given that negotiation was not possible.
"When you have people taken hostage in such large numbers by terrorists with such cold determination and ready to kill those hostages – as they did – Algeria has an approach which to me, as I see it, is the most appropriate," Hollande said.
The apparent ease with which the fighters took control of an important energy facility, which produces 10% of the natural gas on which Algeria depends for export income, has raised questions over the value of outwardly tough Algerian security measures.
The gas-plant crisis also marked a serious escalation of unrest in north-west Africa. French forces have been in Mali since last week fighting an Islamist takeover of Timbuktu and other towns.
Belmokhtar said his attack on the Algerian gas plant was a response to the French offensive, but some US and European officials say the raid needed too much planning to have been organised from scratch in the week since France launched strikes.
Despite deaths among the hostages, an Algerian government source quoted by APS strongly defended the military operation, saying it prevented a "true disaster" which would have caused "immeasurable" human and material damage. The mission was carried out in "extremely complex circumstances" against terrorists armed with a huge arsenal of missiles, rocket launchers, grenades and assault rifles, the source said.
Swift action was the "only way to minimise or neutralise the deadly intent of the multinational terrorists ".
As freed hostages left the plant, accounts emerged of their horrific treatment by the kidnappers.
One Algerian worker named Chabane heard from a hiding place the militants speaking among themselves with Libyan, Egyptian and Tunisian accents. At one point, he said, they caught a Briton.
"They threatened him until he called out in English to his friends, telling them, 'Come out, come out. They're not going to kill you. They're looking for the Americans,'" he said.
"A few minutes later they blew him away."
The family of British survivor Darren Matthews, from Saltburn-by-the-Sea in Cleveland, yesterday expressed their relief.
"We have been extremely worried about Darren and we are pleased and relieved to learn that he is safe and well," they said in a statement released through the Foreign Office.
Security in the half-dozen countries around the Sahara desert has long been a preoccupation of the West. Smugglers and militants have earned millions in ransom from kidnappings.
The most powerful Islamist groups in the Sahara were badly weakened by Algeria's military in the civil war in the 1990s. But in the past two years the regional wing of al-Qaeda gained fighters and arms from the civil war in Libya.
France says the hostage incident proves its decision to fight Islamists in neighbouring Mali was necessary.