A 34-year-old Uzbek man suspected of slaughtering 39 people at an Istanbul nightclub on New Year's eve confessed to the massacre on Tuesday, hours after his capture in a police raid.
Authorities detained Abdulgadir Masharipov, who spent 17 days on the run after the attack claimed by the militant Islamic State (IS) group, along with three women and an Iraqi man during a massive police operation in Istanbul.
“The terrorist confessed his crime,” Istanbul Governor Vasip Sahin told reporters, saying the suspect's fingerprints matched those of the attacker and confirming he is an Uzbek national.
“He was trained in Afghanistan and can speak four languages. He's a well-trained terrorist,” added the governor, saying Masharipov is believed to have first entered Turkey in January 2016.
Police also confiscated 197,000 US dollars (185,000 euros), two firearms and clips during the raid on an apartment, he added.
The arrest lessened the anxiety of Istanbul residents, already on edge after a string of attacks, who had feared for more than a fortnight that a trained killer was on the loose in the city.
Local media published a picture of the detained man with blood on his face and T-shirt, his neck gripped by a policeman.
President Recep Tayyip Erdogan hailed the arrest and congratulated the security forces.
“From now on in this country nobody will get away with what they have done,” he said in a speech in Ankara.
“Everyone will be brought to account within the rule of law.”
The operation to capture the suspected militant involved some 2,000 police officers, the Istanbul governor said.
The suspect had apparently slipped into the night following the attack on the glamorous Reina nightclub on the Bosphorus, while police tightened borders to prevent him escaping. But he was hiding in the working-class, densely populated western districts of Istanbul.
Days of police tracking eventually traced him to an apartment in the residential Esenyurt district.
An Iraqi man was also detained with him, as well as three women, one a Egyptian citizen and two others from African states, Sahin said.
All the suspects were currently still being interrogated at the police headquarters, he added.
The IS took responsibility for the bloodbath, the first time it has ever openly claimed a major attack in Turkey.
It had previously been blamed for several strikes in Turkey, including the triple suicide bombings at Istanbul airport in June.
“It is clear that the attack was carried out on behalf of Daesh,” Sahin said, using an Arabic acronym for the IS group, adding that the other four suspects were likely linked to the militants.
Capturing the suspect alive will be seen as a major victory for the Turkish security forces and he may be able to shed light on the existence of other IS cells in the city.
Turkey's Foreign Minister Mevlut Cavusoglu wrote on Twitter that “in the name of the nation” he thanked the police and Interior Minister Suleyman Soylu for the capture.
Prime Minister Binali Yildirim added: “What matters is the capture of the perpetrator of this vile attack and exposing the powers behind him.”
'Tracked for 3 days'
There had been confusion over the attacker's identity in the wake of the massacre, with reports initially suggesting a Kyrgyz national and then a Uighur from China were responsible. But authorities later identified him as a 34-year-old Uzbek who was part of a Central Asian IS cell using the code name Ebu Muhammed Horasani.
Images released by police during the manhunt were taken from a chilling silent video he purportedly took on Istanbul's Taksim Square with a selfie stick, before carrying out the carnage.
According to NTV television, the attacker was captured at 00:15 am (2115 GMT). The police had spotted his location three days earlier, but preferred to track him to identify his contacts.
The investigation had also focused on the central Turkish city of Konya where the attacker was reported to have lived for several weeks after returning from Syria before moving to Istanbul.
A total of fifty people have now been detained in the investigation as a result of 152 raids since the attack, Sahin said.
Of the 39 killed in the Reina attack, 27 were foreigners including citizens from Lebanon, Saudi Arabia, Israel, Iraq and Morocco who had been hoping to celebrate a special New Year.
The attack, just 75 minutes into 2017, rocked Turkey which had already been shaken by a series of attacks in 2016 blamed on jihadists and Kurdish militants that has left hundreds dead.