Police in Istanbul launched a manhunt on Sunday for a gunman who killed at least 39 people, many of them foreigners, at a nightclub packed with New Year's revellers, in an attack officials described as a terrorist act.

The gunman shot his way into the Reina nightclub at around 1:15 a.m. (2215 GMT), just over an hour into the new year, killing a police officer and a civilian as he entered before opening fire at random inside.

Some witnesses spoke of multiple attackers, but officials have not confirmed this.

Turkish Interior Minister Suleyman Soylu said 15 or 16 of those killed were foreigners but that only 21 of the bodies had so far been identified. He said 69 people were in hospital, four of them in a critical condition.

"A manhunt for the terrorist is underway. Police have launched operations. We hope the attacker will be captured soon," he told reporters.

The attack again shook 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.

The club, one of Istanbul's most iconic that is popular with locals and foreigners alike, overlooks the Bosphorus Strait separating Europe and Asia in the city's cosmopolitan Ortakoy district.

Around 500 to 600 people were thought to have been inside when the gunman opened fire, broadcaster CNN Turk said. Some jumped into the waters of the Bosphorus to save themselves and were rescued by police.

Istanbul Governor Vasip Sahin said the attacker had used a "long-range weapon" to "brutally and savagely" fire on people, apparently referring to some sort of assault rifle.

U.S. President Barack Obama, on vacation in Hawaii, expressed condolences and directed his team to offer help to the Turkish authorities, the White House said.

Sahin and Soylu both referred to a single attacker but other reports, including on social media, suggested there may have been more, at least one of them wearing a Santa Claus costume which he later ditched in order to escape.

The Hurriyet newspaper cited witnesses as saying there were multiple attackers and that they shouted in Arabic.

"We were having fun. All of a sudden people started to run. My husband said don't be afraid, and he jumped on me. People ran over me. My husband was hit in three places," one club-goer, Sinem Uyanik, told the newspaper.

"I managed to push through and get out, it was terrible," she said, describing seeing people soaked in blood and adding that there appeared to have been at least two gunmen.

"POLICE MOVED IN QUICKLY"

Dozens of ambulances and police vehicles were dispatched to the club in Ortakoy, a neighbourhood on the city's European side nestled under one of three bridges crossing the Bosphorus and home to nightclubs, restaurants and art galleries.

"I didn't see who was shooting but heard the gun shots and people fled. Police moved in quickly," Sefa Boydas, a Turkish soccer player, wrote on Twitter.

"My girlfriend was wearing high heels. I lifted her and carried her out on my back," he said.

Hurriyet quoted Reina's owner, Mehmet Kocarslan, as saying security measures had been taken over the past 10 days after U.S. intelligence reports suggested a possible attack.

Turkey, a NATO member and part of the U.S.-led coalition against Islamic State, faces multiple security threats including spillover from the war in neighbouring Syria.

It launched a military incursion into Syria in August against the radical Islamist group and is also fighting a Kurdish militant insurgency in its own southeast.

The New Year's Eve attack came five months after Turkey was shaken by a failed military coup, in which more than 240 people were killed, many of them in Istanbul, as rogue soldiers commandeered tanks and fighter jets in a bid to seize power.

Istanbul, Turkey's most populous city, has seen several attacks this year, the latest on Dec. 10, when two bombs claimed by Kurdish militants exploded outside a soccer stadium, killing 44 people and wounding more than 150.

In June, around 45 people were killed and hundreds wounded as three suspected Islamic State militants carried out a gun and bomb attack on Istanbul's main Ataturk airport.