ISTANBUL (AP) — Turkey has identified the gunman in the Istanbul nightclub massacre, the foreign minister said Wednesday, as the president vowed that the country won’t surrender to terrorists or become divided.
The gunman, who killed 39 people during New Year’s celebrations at the Reina club, is still at large. But Foreign Minister Mevlut Cavusoglu said authorities had identified the man, without providing details.
‘‘The identity of the person who carried out the attack on the Reina nightclub has been established,’’ Cavusoglu told state-run news agency Anadolu in a live televised interview.
Turkish police, meanwhile, detained 20 suspected Islamic State group militants, including 11 women, believed to be linked to the attack, Anadolu reported. The operation was launched in the Aegean port city of Izmir.
It said the suspects were from the largely Muslim Russian republic of Dagestan, from China’s Muslim Uighur minority and from Syria. It said they are thought to have lived with the nightclub attacker.
IS has claimed responsibility for the attack, which also wounded nearly 70 people. Of those killed, 27 were foreigners, many from the Middle East. Islamic State said a ‘‘soldier of the caliphate’’ had carried out the mass shooting to avenge Turkish military operations against IS in northern Syria.
The private Dogan news agency said that Wednesday’s police operation targeted three families who had arrived in Izmir about 20 days ago from Konya — a city in central Turkey where the gunman is thought to have been based before carrying out the nightclub attack. It said 27 people, including women and children, were taken into custody.
At least 16 people were previously detained in connection with the attack, including two foreigners stopped Tuesday at the international terminal of Istanbul’s Ataturk Airport after police checked their cellphones and luggage, according to Anadolu.
President Recep Tayyip Erdogan said that the attack aimed to set Turks against each other and deepen fault lines, but that the country would not fall ‘‘for this game.’’
Erdogan made the comments in a live speech from Ankara, the first time he has publicly addressed the nation since the attack.
Responding to accusations in the past that Turkey had given support to the Islamic State group, Erdogan said that ‘‘to present the country — which is leading the greatest struggle against Daesh — as one that is supporting terrorism is what the terror organization wants.’’
Erdogan said that ‘‘to say Turkey has surrendered to terrorism is to take sides with the terrorists and terror organizations.’’
He added that ‘‘in Turkey, no one’s way of life is under any threat. Those who claim this have to prove it. It is my duty to protect everyone’s rights.’’
That was in response to a campaign before the attack by some government supporters who warned against New Year’s celebrations they depicted as a Western or Christian tradition, as well as some social media postings that seemed to support the attack. The campaign and social media postings caused uproar amid secular Turks who said their lifestyles were being threatened. The government has said authorities were taking measures against social media accounts that allegedly ‘‘support terrorism and foster divisiveness in society.’’
Police in Istanbul have set up checkpoints and are checking vehicles across the city as security levels remain high. Police are stopping cars and Istanbul’s ubiquitous yellow taxis, with passengers and drivers holding up their identifications while officers inspect inside the vehicles.
Hurriyet newspaper said the gunman had previously entered Turkey twice, in 2014 and in 2015. He is believed to have slipped into Syria illegally, where he fought and received training in the use of guns and bombs.
Pro-government Sabah newspaper said the gunman had been in contact with a man believed to be a chief IS operative in Istanbul as well as his aide — a Tajik man who reportedly was among those detained.
According to Sabah, the gunman was born in 1988 and is believed to be a Kyrgyz national. It said he speaks Russian, Uzbek, Arabic and Turkish.
Haber Turk newspaper reported, meanwhile, that after the attack, the gunman walked some 400 meters and then took a taxi but was forced to get out because he didn’t have any money on him. He later got in another taxi and woke up some Uighurs working at a restaurant in Istanbul’s Zeytinburnu district to get some money to pay the driver. The newspaper said seven Uighurs either working or sheltering at the restaurant have since been taken into custody.
Semsettin Dursun, the owner of the restaurant, confirmed that some staff were detained but dismissed claims they were involved.
‘‘They are innocent,’’ Dursun told reporters. ‘‘That is the taxi driver’s claim. It is a single taxi driver’s claim. We don’t accept it. There is no other evidence.’’
Turkey’s European Union affairs minister, Omer Celik, said the attack was carried out in an ‘‘extremely professional way’’ and that the assailant appeared to have received training ‘‘in the Middle East.’’
He said the attacker was using methods ‘‘that avoid all modern intelligence techniques’’ of tracking, including acting alone, not contacting anyone and ‘‘not using technology.’’
Turkish media reports claimed Tuesday that the gunman’s wife was in custody and had told police she didn’t know her husband was linked to IS. An eerie selfie video emerged of the alleged gunman on Tuesday, showing him silently touring Istanbul’s most famous square.
Funerals were held in Jordan, Lebanon, Israel and Turkey for the dead, and on Wednesday, a Turkish Airlines jet carrying the bodies of two Indian citizens killed in the shooting landed in Mumbai. The bodies were received by a governing party lawmaker, and the victims’ relatives and friends.
Bollywood film producer-realtor Abis Rizvi’s body was taken to his home in suburban Bandra for burial later Wednesday. The 49-year-old Rizvi in 2014 wrote, produced and directed a Bollywood movie ‘‘Roar: The Tigers of Sunderbans’’ aimed at spreading awareness about tigers.
The other Indian victim of the Istanbul attack was Khushi Shah, a 27-year-old fashion designer from Vadodara, a city in the western Indian state of Gujarat. Shah’s body was flown to her hometown for cremation later Wednesday, the Press Trust of India news agency reported.
___Associated Press writer Suzan Fraser in Ankara and Mehmet Guzel in Istanbul contributed to this report.