ISTANBUL — The Islamic State group on Monday claimed responsibility for the New Year's attack at a popular Istanbul nightclub that killed 39 people and wounded scores of others.
Turkish police meanwhile detained eight people in connection with the attack but were still hunting for the gunman who disappeared amid the chaos of the attack.
The IS-linked Aamaq News Agency said the attack was carried out by a "heroic soldier of the caliphate" who attacked the nightclub "where Christians were celebrating their pagan feast."
It said the man fired an automatic rifle and also detonated hand grenades in "revenge for God's religion and in response to the orders" of IS leader Abu Bakr al-Baghdadi.
The group described Turkey as "the servant of the cross" and also suggested it was in retaliation for Turkish military offensives against the Islamic State group in Syria and Iraq.
"We let infidel Turkey know that the blood of Muslims that is being shed by its airstrikes and artillery shelling will turn into fire on its territories," the statement said.
Deputy Prime Minister Numan Kurtulmus on Monday confirmed news reports that said eight people were taken into custody but did not provide details, saying a "sensitive" investigation was underway.
Authorities had obtained the fingerprints and a basic description of the gunman and were close to identifying him, Kurtulmus said.
He said the attack in the early hours of 2017 was a message from extremist organizations that they intend to continue to be a "scourge" against Turkey in the new year. Kurtulmus also said it was intended as a response to Turkey's "successful and determined" military operation against the IS in Syria.
He said Turkey was determined to continue fighting violent groups declaring: "Wherever they may hide in 2017, we will enter their lair... With the will of God, with the support of our people, with all our national capacity, we will bring them to their knees and give them all the necessary response."
Earlier, Turkish media reports said that Turkish authorities believed the IS group was behind the attack and that the gunman was likely to be either from Uzbekistan or Kyrgyzstan.
According to the Hurriyet and Karar newspapers, police had also established similarities with the high-casualty suicide bomb and gun attack at Istanbul's Ataturk Airport in June and were investigating whether the same IS cell could have carried out both attacks.
Kyrgyzstan's Foreign Ministry said it was looking into the media reports.
"We have ordered the consul in Istanbul the check this report that has appeared in the press," the Interfax news agency quoted ministry spokeswoman Aiymkan Kulukeyeva as saying Monday. "According to preliminary information, this information is doubtful but we are checking all the same."
The gunman killed a policeman and another man outside the Reina club in the early hours of 2017 before entering and firing with an automatic rifle at an estimated 600 people partying inside.
Nearly two-thirds of the dead in the upscale club, which is frequented by local celebrities, were foreigners, Turkey's Anadolu Agency said. Many of them hailed from the Middle East.
Citing Justice Ministry officials, Anadolu reported that 38 of the 39 dead have been identified. The report said 11 of them were Turkish nationals, and one was a Turkish-Belgian dual citizen.
The report says seven victims were from Saudi Arabia; three each were from Lebanon and Iraq; two each were from Tunisia, India, Morocco and Jordan. Kuwait, Canada, Israel, Syria and Russia each lost one citizen.
Relatives of the victims and embassy personal were seen walking into an Istanbul morgue to claim the bodies.
Turkish officials haven't released the names of those identified.
The mass shooting followed more than 30 violent acts over the past year in Turkey, which is a member of the NATO alliance and a partner in the U.S.-led coalition fighting against the Islamic State group in Syria and Iraq.
The country suffered multiple bombings in 2016, including three in Istanbul that authorities blamed on IS, a failed coup attempt in July and renewed conflict with Kurdish rebels in the southeast.
The Islamic State group claims to have cells in the country. Analysts think it was behind suicide bombings last January and March that targeted tourists on Istanbul's iconic Istiklal Street as well as the attack at Ataturk Airport in June, which killed 45 people. Authorities have said the three suicide bombers in the airport attack were Russia, Uzbekistan and Kyrgyzstan and there has been speculation that Akhmed Chatayev, a Chechen extremist known to be a top lieutenant in the IS militant group, may have directed the attack.
In August, Turkey sent troops and tanks into northern Syria, to clear a border area from the IS and also curb the territorial advances of Syrian Kurdish forces in the region. The incursion followed an IS suicide attack on an outdoor wedding party in the city of Gaziantep, near the border with Syria, that killed more than 50 people.
In December, IS released a video purportedly showing the killing of two Turkish soldiers and urged its supporters to "conquer" Istanbul. Turkey's jets regularly bomb the group in the northern Syrian town of Al-Bab. Turkish authorities haven't confirmed the authenticity of the video.
Last week, Turkey and Russia brokered a cease-fire for Syria that excludes the IS and other groups considered to be terrorist organizations.
On Monday, Anadolu said more than 100 Islamic State targets in Syria have been hit by Turkey and Russia in separate operations.
Citing the Turkish Chief of General Staff's office, Anadolu said Turkish jets struck eight IS group targets while tanks and artillery fired upon 103 targets near Al Bab, killing 22 extremists while destroying many structures. The Russian jets also attacked IS targets in Dayr Kak, eight kilometers (five miles) to the southwest of Al Bab.
Prime Minister Binali Yildirim said the attacker left a gun at the club and escaped by "taking advantage of the chaos" that ensued. Some customers reportedly jumped into the waters of the Bosporus to escape the attack.
Bassem Mroue reported from Beirut. Suzan Fraser in Ankara, and Cinar Kiper in Istanbul, contributed to this report.