The gunman suspected of killing 39 people in an Istanbul nightclub on New Year's Day has been caught by police in Istanbul’s Esenyurt district, media reports said on Tuesday.

The man, identified by Turkey’s Hurriyet newspaper and other media as an Uzbek national Abdulkadir Masharipov, was reportedly captured in a police raid on January 16. 

The man, who media quoted police as saying had operated under the cover name Abu Muhammad Horasani, was caught in a hideout with his four-year-old son, Hurriyet said.  

Haberturk website says there were three people in the apartment where he was caught, the home of a Kyrgyz friend of his to which he had gone three days earlier.

Reuters reports that according to Turkish state-run Anadolu news agency, five people were detained in the operation, including the alleged perpetrator, a man of Kyrgyz origin and three women.  It said simultaneous raids were being conducted on other cells linked to the group.

Associated Press (AP) says that Turkish Foreign Minister Mevlut Cavusoglu posted a Twitter message thanking the interior minister, Suleyman Soylu, police and intelligence organizations “who caught the Reina attacker in the name of the people.”  Earlier in the day, Turkish Deputy Prime Minister Numan Kurtulmus said the Reina nightclub attack had been carried out professionally with the help of an intelligence organization, a claim he had made in the first days after the attack.  He did not name the organization suspected of being involved.

Dozens of people have previously been detained in connection with the attack for which Islamic State (IS) terrorist group has claimed responsibility, saying it was revenge for Turkish military involvement in Syria.

On January 1, the attacker shot his way into the Reina nightclub then opened fire with an automatic rifle, reloading his weapon half a dozen times and shooting the wounded as they lay on the ground.

Turks as well as visitors from several Arab nations, India and Canada were among those killed in the attack.

News agencies cited security sources as saying that operations against other potential terrorist cells were under way January 17.

IS has been blamed for at least six major attacks in Turkey since mid-2015, including an attack on a peace rally in October 2015 that killed more than 100 in Ankara.