Islamic State has claimed responsibility for the Istanbul nightclub attack that killed 39 partygoers in the first hours of 2017 when a lone gunman fired 180 bullets in a seven-minute shooting spree.

Turkish police have arrested eight people in connection with the attack and released a blurred photograph of the suspect. The Turkish military retaliated against Isis with airstrikes and artillery fire against the group in Syria.

A photo released by the Turkish police of their main suspect for the gun attack.

Authorities had obtained the fingerprints and a basic description of the gunman and were close to identifying him, said the Turkish deputy prime minister, Numan Kurtulmuş, after a cabinet meeting on Monday evening.

Kurtulmuş said the attack was a message from extremist groups that they intended to be a “scourge” against Turkey, but said it was determined to fight back. “Wherever they may hide in 2017, we will enter their lair,” he said.

“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.”

The gunman killed a police officer and another person in order to enter the Reina nightclub, which overlooks the Bosphorus in the wealthy Ortaköy neighbourhood of Turkey’s largest city. Nearly two-thirds of those killed in the club, which is frequented by celebrities, were foreigners. Many of them were from the Middle East. Sixty-nine people were injured.

The Isis-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 detonated hand grenades in “revenge for God’s religion and in response to the orders” of Isis leader Abu Bakr al-Baghdadi.

See the full visual

The group described Turkey as “the servant of the cross” and suggested it was in retaliation for Turkish military offensives against Isis 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.

Turkish authorities reportedly believe the attacker is likely to be either from Uzbekistan or Kyrgyzstan. Kyrgyzstan’s foreign ministry said it was looking into the media reports.

Eleven of those killed were Turkish nationals and one was a Turkish-Belgian dual citizen, reports said. Seven victims were from Saudi Arabia; there were three each from Lebanon and Iraq; two each from Tunisia, India, Morocco and Jordan, and one each from Kuwait, Canada, Israel, Syria and Russia.

Those in Istanbul to collect the bodies of their loved ones included the father of Mehmet Kerim Akyil, 23, who had flown from Belgium to Turkey to celebrate new year, and relatives of Bulent Sirvan Osman, 38, a married father of two from Irbil, Iraq, who was in Istanbul on business.

The German foreign ministry said two residents of Bavaria, one a Turkish national and one a dual Turkish-German citizen, had died in the attack.

Turkish media reports said police had established similarities with a suicide bomb and gun attack at Istanbul’s Atatürk airport in June and were investigating whether the same Isis cell could have carried out both atrocities.

Flowers and pictures of the victims near the entrance of the Reina nightclub. Photograph: Yagiz Karahan/Reuters

It remains unclear how the attacker managed to escape from the club, which is just across the street from a police station. One report suggested he had abandoned his weapon and mingled with the crowd outside, pretending to be an injured civilian.

The Turkish prime minister, Binali Yıldırım, said the attacker left a gun at the scene and escaped by “taking advantage of the chaos”.

There were more than 30 violent acts last year in Turkey, which is a Nato member and a partner in the US-led coalition fighting Isis in Syria and Iraq. There were a number of bombings, including three in Istanbul that authorities blamed on Isis, a failed coup attempt in July and renewed conflict with Kurdish rebels in the south-east.

Isis claims to have active cells in Turkey. Analysts believe it was behind suicide bombings last January and March that targeted tourists on İstiklal Street in Istanbul and the attack at Atatürk airport in June, in which 45 people died.

In December, Isis released a video purportedly showing the killing of two Turkish soldiers and urged its supporters to “conquer” Istanbul. Turkish authorities have not confirmed the authenticity of the video.