A manhunt is underway for a gunman who opened fire on New Year revellers at an Istanbul nightclub, killing at least 39 people, including many foreigners.
Some people jumped into the adjacent Bosphorus waterway to save themselves after the attacker began shooting at random in the Reina nightclub just over an hour into the new year on Sunday.
Witnesses described diving under tables as the assailant walked around spraying bullets from an automatic rifle.
The attack shook NATO member Turkey as it tries to recover from a failed July coup and a series of deadly bombings in cities including Istanbul and the capital Ankara, some blamed on Islamic State and others claimed by Kurdish militants.
"At first we thought some men were fighting with each other," said a Lebanese woman called Hadeel who was in the club with her husband and a friend. "Then we heard the sound of the gunfire and ducked under the tables.
"We heard the guy screaming Allahu Akbar (God is Greatest), all three of us heard that ... We heard his footsteps crushing the broken glass," she told Reuters. "We got out through the kitchen, there was blood everywhere and bodies."
Officials spoke of a single attacker but some reports citing witnesses including on social media suggested there may have been several.
A massive security operation unfolded to track down the fugitive assailant or assailants and any conspirators.
Nationals of Saudi Arabia, Morocco, Lebanon, Libya, Israel, a Turkish-Belgian dual citizen and a Franco-Tunisian woman were among those killed, officials said. Saudi newspaper al-Riyadh said five of the dead were from Saudi Arabia.
France said three of its citizens were wounded.
Turkish Interior Minister Suleyman Soylu said 15 or 16 of those killed at Reina were foreigners but only 21 bodies had so far been identified. He told reporters 69 people were in hospital, four of them in critical condition.
Turkey is part of the US-led coalition against Islamic State and launched an incursion into Syria in August to drive the radical Sunni militants from its borders and to curb Kurdish militants.
Turkey is also fighting Kurdish militants in its southeast.
"As a nation, we will fight to the end against not just the armed attacks of terror groups, but also against their economic, political and social attacks," President Tayyip Erdogan said in a written statement.
"They are trying to create chaos, demoralise our people, and destabilise our country ... We will retain our cool-headedness as a nation, standing more closely together, and we will never give ground to such dirty games," he said.
Reina is one of Istanbul's best known nightspots, popular with local high society and foreigners. Some 600 people were thought to be inside when the gunman shot dead a policeman and civilian at the door, forced his way in and then opened fire.