At least 600 people were celebrating the new year - just 75 minutes old - when a gunman opened fire at Istanbul's Reina nightclub, spraying 180 bullets at revelers.
Reina is a glitzy venue, known for attracting famous singers, actors and sports stars. It also attracts a wide range of nationalities.
Among the 39 people killed, the biggest single nationality was Turkish, but some two-thirds of the dead were from other countries.
One of the three Lebanese people who lost their lives in the attack, Elias Wardini was a personal trainer. He had travelled to Istanbul to celebrate the New Year with his friends.
His final post on Instagram shows him in Istanbul with Rita Chami, 25, who also died in the attack.
The third Lebanese citizen killed was Haikal Mussalem, 39, who owned a fitness club. His wife survived the arrack.
The Jordanian parliament held a moment of silence on Tuesday for two men who died in the attack. They were Nawras Assaf and Mohammad Al-Sarraf, who were celebrating New Year's Eve in Istanbul along with their wives, who were both injured but survived.
Leanne Nasser, 18, an Arab-Israeli from the northern town of Tira, is thought to be the youngest victim. She went to Istanbul with several friends.
Israeli officials said her family tried to persuade her not to go due to recent attacks. One of her friends was wounded in the nightclub attack.
Leanne's uncle Rani said: "It's so hard to understand. A few days ago we could hold her and now she is gone."
Among the Turkish victims was Hatice Koc, who was working as a private security guard deployed specially for the New Year celebrations.
After December's bomb attack on a stadium in Istanbul, which killed 44, she wrote on Facebook: "You were the place I had the pleasure of coming to, the place I looked forward to being deployed to. Now it'll always hurt when I see you."
Another security guard, Fatih Cakmak, who survived that attack on the Besiktas stadium, was killed while working at the Reina nightclub.
His brother said he was a courageous man, who "fought day and night to make a living".
Burak Yildiz, a 22-year-old police officer, was shot dead outside the club.
Anadolu news agency reported that his body was being transported for burial in the southern city of Mersin.
Mustafa Sezgin Seymen, 32, travelled to Istanbul to take part in New Year festivities with his fiancee, Sezan Arseven.
She posted a picture of them together on Facebook and wrote: "I lost my other half. I lost my partner, my love."
A friend described him as "generous, lively, a person [that] cannot be described with words".
Local media reports say that Ayhan Arik, 47, a Turkish travel agent and father of two, was shot dead outside the club.
A relative said: "He was talking to the police officer in front - turns out they were born in the same city. He used to work at a tourism agency, taking tourists on tour."
Flags in the Belgian town of Houthalen-Helchteren were lowered to half-mast to remember Mehmet Kerim Akyil, 23.
Originally from Kayseri in Turkey, he managed a restaurant with his father and had gone to Istanbul for New Year with his girlfriend.
Houthalen-Helchteren mayor Alain Yzermans said he was well known in the town for being a sociable and open person.
Yunus Gormek, also 23, was working at the Reina nightclub at the time of the attack.
A relative wrote on Twitter: "We lost Yunus Gormek, who worked for Reina, in the horrible attack... he was working to pay for his education."
Alaa Al-Muhandia was a mother of two from Milton, Ontario. She had spent the last few months in Jordan and had travelled to Istanbul to ring in the new year. Her family described her as an "outgoing, optimistic and loving person".
Seven of those who died were from Saudi Arabia. Among them were twins Mohammed and Ahmed Saud Al-Fadl, 24, who had just graduated from university, and Lubna Ghaznawi, 24.
Abis Rizvi was a 49-year-old Bollywood producer who co-wrote Roar: The Tigers of Sunderbans in 2014. He was working on a second film.
He was one of two Indians killed. The other was Khushi Shah, a Mumbai fashion designer in her 20s.
Husband and wife Mohamed Azzabi and Senda Nakaa left behind a five-month old orphan. Ms Nakaa was also a citizen of France, and the French ambassador to Tunisia said his country would treat the baby as a ward of the state.
Bulent Sirvan Osman, a married father-of-two, was on a business trip to Turkey.