ISTANBUL — The gunman suspected of killing 39 people in an Istanbul nightclub on New Year’s Day has been caught by police in the city’s Esenyurt district, the Hurriyet newspaper website and other media reports said Tuesday.

The man, whom media quoted police as saying had operated under the cover name Abu Muhammed Horasani, was caught in a hideout with his 4-year-old son, Hurriyet said. The reports could not immediately be confirmed.

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

On Jan. 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.

Horasani was described as being of Uzbek origin by the Haberturk website, which said he was caught at a housing complex in Esenyurt district, on the European side of the city.

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, Haberturk said.

According to 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.

The shooting in Istanbul’s Ortakoy neighborhood, an upscale district on the Bosphorus shore, came after a year in which NATO member Turkey was shaken by a series of attacks by radical Islamist and Kurdish militants and by a failed coup.

One security source said in the wake of the attack that the gunman appeared to have been well-versed in guerrilla warfare and may have trained in Syria.

President Tayyip Erdogan has said the attack, which targeted a club popular with local celebrities and moneyed foreigners, had been being exploited to try to divide the largely Sunni Muslim nation.