The man suspected of shooting dead 39 people in a New Year’s Eve attack on a nightclub in Istanbul has been arrested, Turkish officials said late last night.

It is understood the Uzbek national, named as Abdulkadir Masharipov by the Turkish media, was captured in a raid by security forces on a house in the residential Esenyurt district of Istanbul, 25 miles from where the attack took place.

A state news agency also reported that four other people were arrested with him, including a Kyrgyz man and three women.

The state-run Anadolu Agency said the suspects were being taken to Istanbul’s police headquarters for questioning. It also claimed police were carrying out raids on other suspected Islamic State cells.

After the arrest, Turkey’s foreign minister, Mevlüt Çavuşoğlu, thanked police and security organisations “who caught the Reina attacker in the name of the people”.

In the last two weeks, dozens of people across Turkey have been detained and questioned in connection with the deadly assault at the Reina nightclub.

During the attack on new year revellers, the gunman arrived by taxi at the upmarket venue in the Ortaköy district on 31 December and shot dead 21-year-old police officer Burak Yıldız and Ayhan Arık, a 47-year-old travel agent who had been walking past the entrance.

He then went inside and started spraying bullets at the 600 partygoers. The attacker repeatedly reloaded his weapon to shoot the wounded as they lay on the ground. At least 70 people were injured.

Isis has claimed responsibility for the attack, saying it was revenge for Turkish military involvement in Syria.

After fleeing the scene of the massacre, it is believed the gunman initially hid in a safe house, where he was joined by his wife and children. He then fled with his four-year-old son, who was still with him when he was pinned down by officers and handcuffed, according to the Turkish newspaper Hürriyet. A photograph circulated on social media by the publication shows a bruised and bloodied black-haired man.

Abdulkadir Masharipov was captured in a raid by security forces at a house in the residential Esenyurt district of Istanbul just 25 miles from where the attack took place. Photograph: AP

The Turkish television channel NTV said the suspect’s son had been taken into protective custody. It said police had established the gunman’s whereabouts four or five days ago, but delayed the raid to monitor his movements and contacts.

Before the arrest, Turkey’s deputy prime minister said he believed the attack had been carried out professionally and an intelligence organisation was involved.

During an interview with broadcaster A Haber on Monday, Norman Kurtulmus said: “It was an extremely planned and organised attack.”