Wednesday 16 January: the attack

At 5.40am, Murielle, 46, the on-site emergency nurse at In Amenas gas plant was getting dressed in her bedroom. Her working day was due to start at 6am. The French nurse, specialised in anaesthetics, described herself as hardened to crisis: after a decade in emergency operating theatres, she was a medic during the Kosovo war and worked across Africa on petrol or forestry sites. At In Amenas she was in charge of "mass casualty" situations and ran the on-site ambulance.

But at 5.50am, when she would normally be thinking about breakfast, she was jolted by the "piercing sound" of the gas plant's fire alarm. "It was extremely loud. Then the electricity cut out and plunged us into darkness. There was a lot of smoke. We assumed it was a fire and the team put on their suits and rushed to the emergency vehicles to go and put it out," she said. But then an engineer skidded up in a 4x4, having fled a horrific scene at the living quarters 4km (2.5 miles) away at the site entrance.

He shouted: "Terrorists! Terrorists! It's a terrorist attack!" He said the assailants had taken his radio. "Then we heard shots and explosions," Murielle said. She ran back into the building. There was a clear security protocol for a terrorist attack: hide in offices or bedrooms turn out all lights, close all windows and doors, get under the bed, stay hidden and wait.

"I can deal with stress, I simply don't panic," Murielle said. But she knew she was the only female foreign national on the site of around 800 people. "I said to colleagues, they mustn't catch me, I'm a woman and worse I'm French. They will kill me, or at least rape me. I was very quickly conscious of my problem; my government had just intervened in Mali."

Hiding under furniture in their building Murielle and her colleagues – a group which swelled to 26, including Algerians and three British workers – kept hold of their radios. They were able to listen as the terrorists used the internal radio system to communicate among themselves. A picture emerged of bloodshed at the entrance to the site.

Paul Morgan. Photograph: AFP/Getty Images

In the early hours of the morning, a group of militants had first attacked two buses of workers on their way off the site to In Amenas airport. Three foreigners who tried to escape the bus attack were believed to have been shot as they ran through the sand. Two others were killed as they challenged the militants: first, an Algerian security officer, who managed to activate the gas facility alarm system before he died. The second was Liverpool-born Paul Morgan, a former soldier in the French Foreign legion who fought in the first Gulf war and now worked as a liaison between gas field workers and local security staff.

Next, at around 5.40am, heavily armed militant gunmen in Toyota Land Cruisers stormed the entrance of the gas plant site and headed to the living quarters, where many workers had been preparing for the start of their shift, some eating breakfast, when the alarm sounded.

In Amenas gas field. Photograph: Kjetil Alsvik/AP

The militants, who numbered around 30, had inside intelligence and detailed plans of the important 15-hectare (37.7-acre) site, according to the Algerian prime minister, Abdelmalek Sellal. Run by BP, Norway's Statoil and the Algerian state oil company, the remote site which accounted for 10% of Algeria's considerable natural gas production, lay deep in the southern desert, 800 miles from the Algerian capital, Algiers, and 35 miles from the Libyan border.

There were two separate living –quarters. One was for foreign nationals – workers: single-storey, yellow bungalows in a paved area decorated with the odd desert plant. Then there was an area called "company camp", where local Algerian staff lived separately in airy, one-storey cabins. Many of the Algerians, including chefs, cleaners and restaurant workers, were employed by a subsidiary of the French catering firm, CIS Catering. Régis Arnoux, its company director, said they prepared meals for around 800 people a day at the site and provided the facilities, with "all the services of a traditional hotel". There were two dining rooms and sports facilities. The Japanese staff who worked for JGC, a Japanese engineering firm, employed their own Japanese chef.

Some workers were on a pattern of four-weeks on, four-weeks off, when they went home to their home countries, others did longer stints of seven to eight weeks. While the living quarters were near the entrance, it was a further 4km drive to the main gas facilities where only Murielle and the emergency team lived to deal with fires or explosions. There were around 700 Algerians and 130 foreigners on the site.

Hostages kneel in the sand with their hands in the air. Photograph: AP

From 6am for several hours, the gunmen began a frenzied hunt for –foreigners. One Algerian worker said: "They told us: 'We have nothing against you Algerians, you can take your things and leave.' They said they wanted expats and that they would find them." There were several volleys of Kalashnikov fire and rounds of grenade explosions, then militants went from door to door of the foreigners' living quarters, shooting out locks and searching bedrooms, dragging workers from under beds and behind cupboards. Several Filipino workers who refused to leave their rooms were beaten.

Foreigners were rounded up, many had their hands tied behind their backs with rubber cable-ties, others had their mouths taped. The hostage-takers, which Algerian officials said included at least three explosives experts, set about strapping Semtex bombs around the necks and waists of some of the hostages. Some survivors said foreigners were shot as they ran to escape. The Algerian prime minister later spoke of "numerous foreigners killed with a bullet to the head" in the course of the siege which would last four days.

An Algerian engineer working for the JGC told the French paper Humanité that when militants saw that there were mainly Japanese, Filipino or Malaysians in his block, he heard a commander say he wanted Americans, French and English and "didn't need Asians". He saw two Asian colleagues shot.

Several Algerians helped to hide foreigners, giving them their clothes. Algerians said they sent so many text messages that the local phone network quickly saturated. In the Algerian –living quarters there was a residence for women, many of whom worked as administrative assistants. When the militants began shooting out the locks, the women shouted: "We're women, we wear headscarves!" They were all allowed to leave in a vehicle.

Hostage crisis

By Wednesday afternoon, with little concrete information, the world was trying to picture the siege in straight-forward terms of the hostage-takers – who had told media they were from an Islamist group called Signed in Blood battalion – standing over their hostages.

But the truth – hidden from the public – was far more complex. There were in fact scores of foreigners hidden all over the site: under beds, in false ceilings, under desks, in offices, under tables, some even in enclosures on a roof. But international governments, who had been in contact with many after they had called their families by mobile phone, did not want to make this public and alert the terrorists to the fact there were more victims.

"We understood very quickly that there were two types of hostage, those who were in the assailants' hands, and those who managed to hide," said Didier Le Bret, a former French ambassador to Haiti who was running the crisis cell at his country's foreign office in Paris. "The line was decided to protect them by saying as little as possible. We didn't want to give the hostage-takers any information they didn't know." This is why the French president, François Hollande, said he didn't know how many French were involved. It also explains why British officials on Wednesday publicly said the number of their nationals was "very small", despite knowing since the first news of the attack came into the British embassy at 7.10am that a significant number could be caught up in the crisis.

A photo taken by one of the Algerians held hostage. Photograph: AFP/Getty Images

The French catering firm CIS maintained it only had 150 Algerian workers on site, while it knew that its French catering manager was hidden under a bed and four planks of wood, rationing out cereal bars to himself. He stayed there undetected for 40 hours.

Night of Wednesday 16 January

Murielle and her team were still hiding in their building near the central gas plant. The group were afraid to leave their rooms in daylight because they thought there were militant snipers on top of the gas plant towers with binoculars, looking down for them. But they had made the decision that afternoon that they would try to escape. "There was a very solemn announcement over the radio by the terrorists saying they would put all the expats inside the plant and blow it up," Murielle said. "We were the nearest building to the plant. I wanted to leave, two other expats preferred to stay, saying it was too dangerous. Thank goodness, we persuaded them."

There was a set of big metal-cutters in the ambulance. About 20 metres (66ft) from their building was the fearsome security perimeter: two wire fences, a few metres apart, each three metres high and topped with several rolls of barbed wire. They decided to cut holes through them. "I thought we should leave by night, but Algerian colleagues said it was safer at sun-rise. At night, in total darkness, we'd have to use lamps which meant attackers could shoot us easier. And the locals thought the Algerian army was surrounding us and if they heard a noise they would shoot," she said.

Once they had decided to flee at daybreak, they just had to get through the night. Murielle said stress levels were high. "I saw lots of people who found it very difficult, who were terrorised, both expats and local people. For Algerians, their personal experience of 10 years of civil war had marked them strongly in their youth: explosions, Kalashnikov fire took them right back to that."

The three British nationals slept in their rooms. But after an hour or two's sleep in her own bed, Murielle felt too exposed, she moved to the medical storeroom opposite, next to the ambulance garage. She stayed hidden, upright, all night. "There was a little electricity from the clinic generator, so I made myself a nice hot cup of tea and hid myself in a gap between two buildings, listening out for every noise. Most of all, I stared up at the magnificent starry desert sky. At 5am, I made breakfast – tea, coffee and porridge – for my three expat colleagues, so we would have strength and a full stomach to flee. I thought a meal was symbolic."

The Algerians in the group insisted they all put on their work uniforms to look as similar as possible. Murielle hid her light hair under a hat. One of the British men with her described how when they cut a hole in the first fence, the ping from the cutters felt like it was resounding across the camp and would be heard by the hostage-takers. They crawled through and began walking across the desert. "We'd been told the militants were dressed as military. We didn't know, as we walked 500 metres, 600 metres from the plant whether the people we were to come across were hostage – takers waiting for us or Algerian army. That was a long moment of extra stress." The Algerians in the group carried white sheets above their heads to show they weren't armed. The waiting Algerian army took them to safety in a nearby gendarmerie post.

Veteran jihadist Mokhtar Belmokhtar. Photograph: Reuters

Back at the living quarters, in the course of Wednesday night, a freelance journalist for the French paper Sud Ouest, who had been working on a story about the veteran Islamist Mokhtar Belmokhtar, rang the mobile number of one of his contacts. The contact answered, said he was one of the hostage-takers on the site and had French hostages. Asked for proof, he passed the phone to Yann Desjeux. Desjeux, 52, was a former French special forces soldier from near Bayonne in the French Basque country, where he co-owned a restaurant. A friend of Murielle, they had spent New Year's Eve together with a Briton at the base. Clearly under pressure from hostage-takers, he said he was being treated "fine" and asked France to tell the Algerian army not to stage an assault on the base. A piece ran in Sud Ouest and he became the first named French hostage, a message of hope.

But the reality was that he had explosives strapped around his neck. According to accounts from friends, the soldier, who had served in the Gulf war, managed to neutralise the detonator and reassure other hostages chained with him. But Desjeux, used as a human shield, was to be killed by the hostage-takers the following day.

Thursday 17 January: Algerian forces attack

On Thursday morning, foreign governments were stressing that the situation on the site was extremely serious and difficult. At the crisis room at BP's international headquarters in St James's Square, London, decisions were prioritised by the order "PEP": "people, environment and property". The company's "incident management team" at Hassi Messaoud, 300 miles north-west of In Amenas, helped by British consular officials, were in contact with staff hiding within the complex, according to one hostage. At around lunchtime, according to accounts by Algerian officials, the Algerian forces understood that the militants wanted to blow up the gas facility. They had already mined the edge of the site and pointed five missiles at the main working-facility. The Algerian prime minister later said the militants had tried to take the hostages from the living quarters to the main gas site on Thursday, which sparked the army to begin its first assault on the vehicles they were travelling in.

The body of an unidentified person. Photograph: Echorouk Elyaoumi/Reuters

At around 2pm, the Algerian forces launched an assault on the plant, with helicopters strafing a convoy of militants' vehicles, each containing hostages. Four of the five vehicles were destroyed. All morning, the militants had lined up hostages, with taped mouths and bombs strapped to them, to prepare to transfer them in five 4x4s.

A Filipino survivor, Joseph Balmaceda, who gave a press conference after his escape, 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."

Some hostages were killed at that point. "The terrorists lined up four hostages and assassinated them … shot them in the head," a brother of one of the Britons killed, Kenneth Whiteside, told Sky News. "Kenny just smiled the whole way through. He'd accepted his fate."

Joseph Balmaceda. Photograph: Ted Aljibe/AFP/Getty Images

Balmaceda, nursing abrasions to his face and a loss of hearing, said he was the only survivor out of nine hostages who were aboard a van that exploded, apparently from a C-4 charge rigged to the vehicle by militants. "I was sandwiched between two spare tyres … I crawled about 300 metres to where the government forces were. When I reached them I fainted. I woke up in hospital."

A west Belfast electrical engineer, Stephen McFaul, fled into the desert still wearing a vest of explosives after the vehicle he was travelling in crashed. Earlier in the siege, before being picked out by militants he had managed to stay hidden with colleagues, joking that he was from Northern Ireland "and had been through better riots".

It was not clear how many of the total of around 37 foreigners killed during the siege died at this point. Among them was a Briton, Garry Barlow, who had previously called his wife from the site saying: "I'm sat here at my desk with Semtex strapped to my chest."

The first time the British government learned of the Algerian offensive was after the shooting started. The news was relayed to the embassy, almost certainly from BP. David Cameron immediately called his Algerian counterpart, Abdelmalek Sellal, to remonstrate, pointing out he had asked the previous day to be informed in advance of any such action.

The Japanese prime minister, Shinzo Abe, told reporters he had instructed Sellal to refrain from ordering any action that would put hostages' lives at risk. Abe's chief cabinet secretary described the Algerian forces' actions as "very regrettable".

Night of Thursday 17 January

With the army assault finished by around 8pm, according to Algerian media, the army went into the living quarters to free the hostages they could find. Many were still frozen in their hiding places, with little phone battery left and no electricity. Alexandre Berceaux, 32, the French catering manager, emerged from under his bed, still terrified that the troops were militants, only accepting to go with them because Algerian colleagues reassured him. Back in France he gave a press conference at the recommendation of his family, but his father cut it short, as he was still in a state of shock, haggard and ashen-faced as he pulled up the hood of his Parka to shield himself form the press.

It was after the army assault on Thursday that Tony Griesdale, 60, from Workington in Cumbria, emerged from two days' hiding with seven litres of bottled water. "There was no food for two days, no telecommunications, no electricity, no running water. So I just lay still and relaxed. I made a gameplan for what I'd do if no one came for me and listened to some music on my phone. I don't know if that was a good or a bad thing to do, as it could have attracted the bad guys. I slept most of the time really," he said. Like other British workers who emerged from hiding at this point, he took only his passport as he left his room.

Romanian hostage Liviu Floria. Photograph: Vadim Ghirda/AP

Others decided to make a move without the Algerian troops. Liviu Floria, a Romanian gas worker who had taken In Amenas job to save enough money to send his teenage daughter to college in Britain, joined seven others who managed to scale a fence surrounding the compound. They left around 2am for a difficult desert trek, guided only by the flickering flame atop a gas well in the distance and a compass application on Floria's iPhone. A Japanese hostage who had hidden under a truck for hours also waited until nightfall to walk through the desert for an hour until he met troops. As Algerian forces still search for a handful of missing this week, they have not ruled out people might have disappeared while trying to escape through the desert.

Friday 18 January: the aftermath

With few survivors to tell the tale, the details of Friday's events remain patchy. As the sun-rose, there were still hostages hiding across the site. Peter Hunter, 53, from Durham, said he stayed calm in his hiding place, dressed in local clothes, trying to conserve water and his mobile phone battery. He said: "Thursday was probably the noisiest day. Friday was their equivalent of our Sunday out there. There might have been the odd pop shot during the night, but nothing in the light hours." It wasn't until Saturday that he felt confident enough to change his clothes for the first time in four days.

According to Algerian media reports, in the early hours of Friday morning, the Algerian army moved up to surround the core gas facility area where hostage-takers were holed up with at least seven hostages. The Algerian prime minister said this second assault was more "laborious" because of the "difficulties of access" to the site. Sellal said: "Unfortunately, the last hostages were executed by their hostage-takers with a bullet to the head. There was a collective assassination."

Saturday 19 January

On Saturday morning, the Algerian army made its final assault, to clear the central gas facility where the sound of shots was reported on Friday night. The army rounded up the final hostages from hiding, and began clearing the site.

Martyn Roper, the UK ambassador to Algeria, finally managed to persuade the Algerian government to allow him to fly into In Amenas on Saturday morning, and he arrived with a private jet full of consular officials, police protection officers and forensic specialists. For a while, he was the only foreign ambassador at the field but he was still some 30 miles from the gas field at Tigantourine and could only wait for news of the final assault unfolding down the road, while overseeing the evacuation of the 22 British survivors from In Amenas and Hassi Messaoud. Even now, Tigantourine is closed to foreigners, but British police forensic officers are examining the bodies still in the morgue in Algiers in the hope of identifying the last few missing British nationals.

Rescue workers carry the coffin of one of the hostages. Photograph: Ramzi Boudina/Reuters

The Algerian prime minister would later announce at least 38 civilians had been killed during the course of the four-day siege, and 29 militants. Nearly 700 Algerians and 100 other foreigners survived. Five people were missing. With seven of the foreign dead unidentified, forensic teams from the UK, US and Norway arrived to help identify remains over the course of this week.

Japan emerged with the highest death toll of any country. With 10 dead, it was the biggest loss of Japanese lives overseas since the 9/11, in which 24 were killed. One of the Japanese victims, Rokuro Fuchida, 64, had written on Facebook that he was looking forward to his assignment in Algeria. "I work around the world to see the glittering night-time skies of foreign lands," he said. "I look forward to seeing the starry sky above the desert."

Additional reporting by Valeria Criscione in Oslo

• This article was amended on 28 January 2013. It originally referred to BP's incident management team as an instant management team. This has been corrected.