ISTANBUL – At least one gunman shot his way into an Istanbul nightclub packed with hundreds of New Year's revelers on Sunday, killing 39 people and wounding more than 40 in what the provincial governor described as a terrorist attack.

One assailant shot a police officer and a civilian as he entered the Reina nightclub before opening fire at random inside, Istanbul Governor Vasip Sahin said at the scene. Some reports suggested there were multiple attackers.

"A terrorist with a long-range weapon … brutally and savagely carried out this attack by firing bullets on innocent people who were there solely to celebrate the New Year and have fun," Sahin 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, 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 at around 1:15 a.m., broadcaster CNN Turk said. Some jumped into the waters of the Bosphorus to save themselves and were rescued by police.

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 said there was only one attacker but other reports, including on social media, suggested there may have been at least two, dressed in Santa Claus costumes which they later ditched.

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.

Dozens of ambulances and police vehicles were dispatched to the club in Ortakoy, a neighborhood 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 neighboring 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.