Thirty-nine people, including many foreigners, were killed Sunday when a gunman went on a rampage at an exclusive nightclub in Istanbul where revellers were celebrating the New Year.
As police launched a dragnet for the assailant, President Recep Tayyip Erdogan said the carnage sought to sow chaos and undermine peace, but that Turkey would never bow to the threat.
The shooting spree at the waterside Reina nightclub was unleashed when 2017 in Turkey was just 75 minutes old, after a year of unprecedented bloodshed that saw hundreds of people die in strikes blamed on Kurdish militants and Islamist militants and a bloody failed coup.
The assailant shot dead a policeman and a civilian at the club entrance and then went on the rampage inside where up to 700 people were ringing in the New Year.
Interior Minister Suleyman Soylu said the attacker had escaped and was now the target of a major manhunt, expressing hope the suspect "would be captured soon".
He added that of 20 victims identified so far, 15 were foreigners and five were Turks. Another 65 people were being treated in hospital.
Many revellers threw themselves into the water in panic. Dogan news agency said the gunman was dressed in a Santa Claus outfit, although this has yet to be confirmed.
Soylu said the gunman had arrived with a gun concealed underneath an overcoat but subsequently exited the venue wearing a different garment.
No-one has yet claimed responsibility for the bloodshed.
Family Minister Fatma Betul Sayan Kaya indicated there were many Arabs among the wounded. Jordan said three of its nationals mere killed while the Tunisian foreign ministry said two Tunisians lost their lives.
An Israeli woman 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".
Television pictures showed party-goers -- including men in suits and women in cocktail dresses -- emerging from the 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 organisations" and the countries supporting them, Erdogan said, without giving details on which groups or nations he was referring to.
The attack evoked memories of the November 2015 carnage in Paris when Islamic State Islamist militants went on a gun and bombing rampage on nightspots in the French capital, killing 130 people including 90 at the Bataclan concert hall.
From Sydney to Paris, Rio to London, security had been boosted over fears that the New Year festivities could present 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 (TAK), 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 IS.
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 IS Islamist militants 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.