Police in Turkey are searching on Sunday for gunman who killed at least 39 people at a nightclub Instanbul.
President Recep Tayyip Erdogan said the carnage sought to sow chaos and undermine peace, but vowed that Turkey would never bow to the threat.
The shooting spree at the waterside Reina nightclub was unleashed just 75 minutes into 2017, after a year of unprecedented bloodshed that saw hundreds of people die in strikes blamed on jihadists and Kurdish militants and a bloody failed coup.
The assailant shot dead a policeman and a civilian at the club entrance and then turned his gun on partygoers inside where up to 700 people were ringing in the New Year.
Many revelers threw themselves into the freezing waters of the Bosphorus in panic.
Prime Minister Binali Yildirim said the gunman was still at large after slipping away unnoticed after the attack. But he denied earlier reports the person had used a Santa Claus costume as disguise.
The assailant "left the gun and went away from the scene of the incident," he told reporters in Istanbul. "It was an armed terrorist."
No-one has yet claimed responsibility for the bloodshed.
Interior Minister Suleyman Soylu added that of 20 victims identified so far, 15 were foreigners and five were Turks. Another 65 people were being treated in hospital.
Soylu said the gunman had arrived with a gun concealed underneath an overcoat but subsequently exited the venue wearing a different garment.
There were a number of Arabs among the dead and wounded, including Saudis, Jordanians and Tunisians.
France said a dual-national Tunisian-French woman had died along with her Tunisian husband, while India said it had lost two nationals.
A young Israeli woman, reportedly aged 19, was killed and another injured, Israel's foreign ministry said.
Istanbul governor Vasip Sahin said at the scene on the shores of the Bosphorus that the attacker "targeted innocent people who had only come here to celebrate the New Year and have fun."
The attack evoked memories of the November 2015 carnage in Paris when ISIS militants went on a gun and bombing rampage on nightspots in the French capital, killing 130 people including 90 at the Bataclan concert hall.
Television pictures showed party-goers emerging from the Istanbul nightclub in a state of shock.
Erdogan said in a statement that with such attacks, "they are working to destroy our country's morale and create chaos."
Turkey would deploy every means to fight "terror organizations" and the countries supporting them, Erdogan said, without elaborating.
From Sydney to Paris, Rio to London, security had been boosted over fears that the New Year festivities could be a target for violent extremists.
In Istanbul, at least 17,000 police officers had been deployed and some, as is customary in Turkey, dressed themselves as Santa Claus as cover, according to television reports.
"Just as we were settling down, by the door there was a lot of dust and smoke. Gunshots rang out," witness Sefa Boydas, a professional footballer, told AFP. "When I was walking, people were walking on top of people."
Turkey in 2016 saw more attacks than any other year in the history of the country.
On December 10, 44 people were killed in a double bombing in Istanbul after a football match hosted by top side Besiktas, an attack claimed by the Kurdistan Freedom Falcons, seen as a radical offshoot of the outlawed PKK rebel group.
In June, 47 people were killed in a triple suicide bombing and gun attack at Istanbul's Ataturk airport, with authorities blaming ISIS.
Mainly Muslim Turkey's religious affairs agency Diyanet condemned the attack, saying the fact it took place in a nightclub "was no different to it being in a market or place of worship."
Turkey is still reeling from a failed July coup blamed by the government on the US-based Islamic preacher Fethullah Gulen that has been followed by a relentless purge of his alleged supporters from state institutions.
"It's hard to imagine a crime more cynical than the killing of civilians during a New Year's celebration," Russian President Vladimir Putin said in a condolence message to Erdogan.
Two weeks ago, an off-duty policeman assassinated Russia's ambassador to Turkey in an Ankara art gallery.
The United States and France voiced outrage at Sunday's attack and said they stood alongside their NATO ally in its fight against terror.
German Chancellor Angela Merkel condemned "an inhumane, sneaky attack on people who wanted to celebrate" while Pope Francis condemned the shooting in his New Year message.
The bloodbath came as the Turkish army wages a four-month incursion in Syria to oust ISIS jihadists and Kurdish militants from the border area, suffering increasing casualties.
Turkey is also spearheading a ceasefire plan with Russia aimed at creating a basis for peace talks to end the near six-year civil war.
by Stuart Williams with Raziye Akkoc/AFP