ISTANBUL — A gunman opened fire at a nightclub in Istanbul filled with New Year’s revelers about an hour after midnight Sunday, killing at least 39 people and injuring scores of others, according to Turkish officials.
Fifteen of the people killed were foreigners, the Foreign Ministry said. They included three Jordanians; two Indians; a Tunisian couple; a teenager from Israel; a Lebanese man; and a dual citizen of Belgium and Turkey, according to news agencies and government statements.
Sixty-nine people were hospitalized, four of them in critical condition. Among the scores of injured people were citizens of France, Israel, Morocco, Libya and Saudi Arabia.
Interior Minister Suleyman Soylu said the gunman was being sought.
No one immediately claimed responsibility for the mass shooting, which came as threats against Turkey by the Islamic State and its supporters have increased. It was the fourth terrorist attack in Turkey in less than a month.
“They are working to destroy our country’s morale and create chaos by deliberately targeting our nation’s peace and targeting civilians with these heinous attacks,” President Recep Tayyip Erdogan said in a statement. “We will retain our cool-headedness as a nation, standing more closely together, and we will never give ground to such dirty games.”
He added: “Turkey is determined to continue to fight to the end against terror and to do whatever is necessary to ensure the security of its citizens and secure peace in the region.”
The attack started about 1:15 a.m. at the Reina nightclub, in the Ortakoy neighborhood overlooking the Bosporus. The club is known for its celebrity clientele and its popularity among foreigners. As many as 600 people were celebrating the New Year when a lone attacker, said to be armed with a Kalashnikov rifle, burst in, officials said.
Gov. Vasip Sahin of Istanbul Province said a police officer outside the club had been killed before the bloodshed began inside.
“One person first kills the police officer outside, and then a civilian,” Mr. Sahin said. “Inside, he rained bullets brutally, mercilessly over innocent people who were there just to celebrate the New Year and have fun.”
In the ensuing panic and the rush to escape, some clubgoers jumped into the Bosporus — which separates Europe and Asia — and others hunkered down for safety.
Sinem Uyanik, who was there with her husband, Lutfu Uyanik, told The Associated Press that she had seen several bodies inside the club. Her husband was wounded, she added, but not seriously.
“Before I could understand what was happening, my husband fell on top me,” she said. “I had to lift several bodies from on top of me before I could get out.”
A wounded man on a stretcher told the independent Turkish news agency DHA that the attacker had “put a bullet to the head of anyone alive.”
Television footage showed dozens of ambulances rushing to the scene and people fleeing, some walking with difficulty, arm in arm.
The owner of Reina, Mehmet Kocarslan, told the Hurriyet news site that security measures had been beefed up over the past 10 days after American intelligence officials had warned about an attack in Turkey over the holidays.
The Istanbul shooting came just days after the Nashir Media Foundation, a group identified by experts as supporting the Islamic State, published the last of three messages calling on individual attackers in the West to turn the holiday season into days of “terror and blood.” It urged attacks on clubs, markets and movie theaters.
Nashir Media singled out Turkey in its threats. “Attack the embassies and consulates of Turkey and all coalition countries where you are,” the message said. “Turn their happiness and joy into grieves,” it went on in garbled English, “and their feasts into funerals.”
In addition, there have been numerous official threats by the Islamic State, including from its leader, Abu Bakr al-Baghdadi, who in his most recent speech called for attacks against Turkey.
On Dec. 22, the United States government said in a statement that extremist groups were “continuing aggressive efforts to conduct attacks throughout Turkey” in areas where American citizens and expatriates lived or visited. The statement urged caution about being in crowded places and public gatherings during the holidays.
— Ilån Bεn Zıon (@IlanBenZion) January 1, 2017
The Turkish prime minister, Binali Yildirim, immediately cracked down on news coverage of the attack. He directed news outlets to await official government updates. He invoked a law that enables a news blackout for national security reasons or in cases of serious disturbances to public order.
A White House official said President Obama had been briefed by his national security advisers about the nightclub attack. Mr. Obama expressed his condolences and offered assistance to the Turkish authorities.
“We stand in solidarity with our NATO ally Turkey in combating the ongoing threat of terrorism,” Mark C. Toner, the deputy spokesman for the State Department, said in a statement.
The attack, a bloody start to the new year, drew condemnation from world leaders.
Pope Francis prayed for the victims in the attack, for those injured, “and the whole nation in mourning,” during his weekly address to the faithful on Sunday at St. Peter’s Square, in Vatican City. Expressing his “closeness to the Turkish people,” the pope asked “the Lord to support all people of good will who roll up their sleeves to boldly tackle the scourge of terrorism and this stain of blood that envelops the world with a shadow of fear and bewilderment.”
Marking the Roman Catholic Church’s 50th World Day of Peace, the pope told an estimated 50,000 faithful that peace was built by “saying ‘no’ — with facts — to hate and violence, and ‘yes’ to brotherhood and reconciliation.”
Turkey is still dealing with the aftershocks of a coup attempt that began on July 15, in which at least 265 people were killed.
Though the effort sputtered in a matter of hours, President Recep Tayyip Erdogan responded with a monthslong crackdown targeting dissidents across Turkish society. In addition to arresting thousands of military personnel suspected of involvement in the coup, hundreds of thousands of civil servants, educational workers and journalists have been suspended.
The coup and the assassination of Ambassador Andrey G. Karlov of Russia in Ankara on Dec. 19 raised concerns that the country’s security establishment has grown ineffective. The internal turmoil also raised doubts about how well Turkey would be able to participate in international counterterrorism efforts, especially against the Islamic State.
Since the crackdown began, protests against Mr. Erdogan have led to frequent clashes between demonstrators and the police. And reports of targeted attacks against civilians after martial law was declared in July have revived painful memories of the political violence Turkey experienced in the 1970s and 1980s.
Turkey’s struggles with security had already grown severe months before the coup attempt. A spate of suicide bombings and other attacks since 2015 was capped off by the June 28 attack on Istanbul Ataturk Airport, the country’s busiest. The attack left 45 people dead.
A Kurdish militant group claimed responsibility for a double bombing that killed 39 people and wounded 154 outside a soccer stadium in Istanbul on Dec. 10. That death toll ultimately climbed to 45.
A car bombing in central Turkey killed 13 soldiers and wounded more than 50 other members of the military on Dec. 17. Two days later, Mr. Karlov was assassinated.