At about 05:45 (04:45 GMT) on Wednesday 16 January, a couple of hours before daybreak, two buses were pulling away from the housing compound of the Tigantourine gas plant, deep in the Sahara desert of eastern Algeria.
On board were foreign workers from the plant, run by BP and Statoil of Norway, and home to 132 expatriates.
Some were off to work at the gas refinery, 3km away - among them a Japanese employee of JGC Corp, which does engineering work at the plant.
Seconds after the buses left the compound, gunfire erupted out of the darkness.
The driver of the bus on which the JGC man sat slammed it into reverse, trying desperately to get back into the fortified living compound.
Up front, the gas workers' armed escort battled the attackers. Two people, a Briton and an Algerian, were killed in this, the opening battle of the hostage crisis. The front bus managed to travel on to In Amenas
As the rear bus reversed, a wheel came off and the passengers got out, the Japanese employee was quoted as saying by a JGC company spokesman in an interview for Japan's Daily Yomiuri newspaper.
They ran to what they hoped would be the safety of the living quarters.Door smashed open
Azedine (his surname was not given), a 27-year-old radio operator in the communications room, both heard the shooting and logged a contact with one of the bus drivers, he later told Reuters news agency.
Almost immediately after the gun battle, the gunmen were inside, travelling in at least three vehicles, he said.
Azedine was able to get a good view of the militants and hear their conversations.
"They were talking in Arabic but I did not understand what they were saying," he said. "Some were clean, others were dirty, some with beards, others without."
Four days later, a video tape would emerge on which the gunmen's Algerian leader, Mokhtar Belmokhtar, would say that 40 members of his Islamist group were involved, describing them as being from the Muslim world and a number of unspecified European countries.
The Algerian government later said the gunmen had arrived from northern Mali and included a Canadian citizen.
As Azedine escaped, he caught sight of the body of his French supervisor.
The JGC employee who had run from the bus locked himself inside a room in the compound and turned off the lights, only to see militants smash open the door.
Handcuffed, he was taken to where other foreign hostages were being detained.
Two of the man's Algerian colleagues were shot dead before his eyes. He and a Filipino colleague were bundled into a vehicle, but as it drove towards the gas plant it suddenly came under fire.
Both gunmen fled, abandoning their two captives.
The Japanese man under a truck for hours as shooting continued. When night fell, he walked out into the desert, eventually coming across Algerian soldiers who had surrounded the site.'Indebted for life'
It was to be an agonisingly long night for those still trapped in the compound.
French caterer Alexandre Berceaux managed to remain hidden under a bed for 40 hours. Algerian employees smuggled him food with a password.
End Quote Alexandre Berceaux Survivor
I could see myself already ending up in a pine box”
"I didn't know how long I was going to stay there," he told Europe 1 radio. "I could see myself already ending up in a pine box."
Speaking later to Reuters, he said he believed Algerian staff had been at risk, not just foreigners.
"There were shots everywhere, they could have fallen anywhere," he said.
Some of the hundreds of Algerian employees at the plant later told how the gunmen had assured them they meant Muslims no harm, only Christians and other non-Muslims.
Alan Wright, from Scotland, also survived the siege with the help of Algerian colleagues, hiding out in an office before making his escape.
"The guys who had the option to surrender and be safe but decided to stay and help us escape, you'll be in debt to them for the rest of your life," he said.
Meanwhile the gunmen had captured dozens of foreigners, among them Irish electrician Stephen McFaul.Air attack
On Thursday morning, the gunmen strapped explosives to the Belfast man and other hostages, before putting them on four-wheel-drive vehicles, he later told his wife by phone.
As Mr McFaul waited, Semtex strapped to his body, his hands tied, tape over his mouth, the militants' commander, Abu al-Baraa, phoned al-Jazeera TV.
He accused the Algerian army of jeopardising the hostages' safety on the first day. Japanese and South Korean citizens had been injured, he said.
If the army withdrew troops and lifted their siege, he told the channel, talks could be held with the governments of those foreign states whose citizens had been captured.
He demanded the release of Islamist militants held in prison in exchange for the hostages.
End Quote Ruben Andrada Surviving hostage
I closed my eyes. We were going around in the desert. To me, I left it all to fate”
Minutes after the call, the convoy of between five and seven vehicles, loaded with hostages and gunmen, was heading from the housing compound towards the refinery.
Ruben Andrada, 49, a Filipino civil engineer working for JGC Corp, was aboard one of the vehicles with a bomb tied around his neck.
As the vehicles left the compound, around noon (11:00 GMT), Algerian attack helicopters opened up with guns and rockets.
"There was shooting all around," Mr Andrada told the Associated Press. "I closed my eyes. We were going around in the desert. To me, I left it all to fate."
Mr McFaul counted four vehicles hit by the bombardment. His own crashed, allowing him to escape.
Video recorded at the site after the siege shows vehicles ripped apart and charred beyond recognition on the sand.
According to Mr Andrada, the vehicles had been carrying 35 hostages guarded by 15 militants. Abu al-Baraa was reportedly among the dead.
Mr Andrada's own vehicle toppled over and he found himself pinned down by the man next to him, listening to the clatter of the helicopter's blades directly above, "waiting for a bullet from the helicopter to hit me".
Cut, bruised, grazed on his elbow by a bullet, he finally managed to escape.Final assault
We do not know if any of the vehicles in the convoy made it past the deadly fire to the refinery but, somehow, a group of gunmen managed to reach it with hostages.
The gunmen's new commander, Abdel Rahman al-Nigeri, said after Thursday's air attack that half the militants had been killed by the army. If they attacked again, he warned in a phone call, the remaining hostages would be blown up.
On Friday, they said they were still holding seven foreign hostages. According to the Algerian government, 11 surviving gunmen, armed with rocket-launchers and machine-guns, were holed up in a workshop with seven hostages.
The refinery had been put out of action to avoid the risk of an explosion, an Algerian security source said, and Algerian special forces were seeking a "peaceful end" to the crisis.
It did not come. Accusing the militants of seeking to blow up the refinery and kill the remaining captives, the government launched a new assault. All the remaining hostages were killed.
During the four-day siege, at least 39 foreign hostages were killed, according to the Algerian government. Of their 32 attackers, 29 were killed and three captured alive, it said. Nearly 700 Algerian workers and more than 100 foreigners escaped.
The government in Algiers said it believed the gunmen's original aim had been to take the hostages back into Mali, where Islamist forces have been fighting the government and, now, the French military.