We now know who is responsible for the tragic nightclub shooting in Turkey that killed 39 people

Demonstrators chant pro-al-Qaida-inspired Islamic State of Iraq and the Levant (ISIL) as they wave al-Qaida flags in front of the provincial government headquarters in Mosul, 225 miles (360 kilometers) northwest of Baghdad, Iraq, Monday, June 16, 2014. Sunni militants captured a key northern Iraqi town along the highway to Syria early on Monday, compounding the woes of Iraq's Shiite-led government a week after it lost a vast swath of territory to the insurgents in the country's north. (AP Photo)

ISTANBUL (AP) — 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.

Videos by Rare

Turkish police meanwhile detained eight people in connection to 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.

Turkey’s state-run Anadolu Agency said eight people were taken into custody by Istanbul anti-terrorism squads and they are being questioned at Istanbul’s main police headquarters. It did not provide further information on the suspects.

Earlier, Turkish media reports had said that Turkish authorities believed the IS group was behind the attack and that the gunman, who is still at large, is 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 was investigating whether the same IS cell could have carried out both attacks.

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.

RELATED: Chilling new video shows a Turkish assassin moments before he gunned down a Russian ambassador

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.

What do you think?

Chicago just posted a jaw-dropping homicide count for 2016

The feud between Mariah Carey and Dick Clark Productions continues in the days after her embarrasing New Year’s Eve performance