Turkish authorities say they have captured the man they believe gunned down 39 people at an Istanbul nightclub on New Year's Day.
Prime Minister Binali Yildirim said on January 17 that the suspect was being questioned by police and expressed hope that the interrogation would unveil "powers" behind the attack, which also left dozens of people wounded. He did not provide further details.
Istanbul Governor Vasip Sahin identified the suspect as Abdulkadir Masharipov and said he was born in Uzbekistan in 1983 and had trained in Afghanistan.
Sahin said that Masharipov had confessed to carrying out the massacre, adding that his fingerprints matched prints found at the scene of the attack.
Authorities say the lone gunman arrived in a taxi and shot two people on the street before entering the upscale Reina nightclub early on January 1 and opening fire on revelers.
Sahin described Masharipov, who he said operated under the cover name Abu Muhammed Horasani, as "a well-educated terrorist who speaks four languages."
The governor also said there were strong indications the suspect entered Turkey illegally through its eastern borders in January 2016.
He added that he had clearly carried out the nightclub massacre in the name of the Islamic State (IS) extremist group, which claimed responsibility for the attack, saying it was revenge for Turkish military involvement in Syria.
Afghan Interior Ministry spokesman Sediq Sediqi said it was too early to say whether the suspect was trained in Afghanistan, but he insisted that "all terrorist networks are based outside Afghanistan's territory."
"We have always done the maximum in order to prevent terrorists from having training centers and safe havens inside of Afghanistan," Sediqi told RFE/RL’s Radio Free Afghanistan. "But unfortunately the Taliban and terrorist groups have training centers and safe havens inside Pakistan's territory."
Turkish media reported earlier that police detained the alleged attacker late on January 16 in a police raid on an apartment in Istanbul's Esenyurt district.
Police released a photo of the suspect, showing a man with a bloodstained shirt and cuts and bruises on his face.
One Iraqi man and three women from Egypt and Africa were also detained at the same apartment, Sahin said.
He also said the main suspect's 4-year-old son was not with him when he was caught, contradicting earlier reports.
Police also seized two firearms, ammunition, and $197,000 in the raid, Sahin added.
The alleged attacker was being questioned at Istanbul police headquarters, while other people were detained in raids across the city targeting Uzbek IS cells, the state-run Anadolu news agency reported.
A total of 50 people had now been detained in the investigation, Sahin said.
In Ankara, President Recep Tayyip Erdogan hailed the arrest and thanked Turkey's security and intelligence agencies for their efforts.
"In this country, nobody will get away with what they have done," Erdogan said. "Everyone will be brought to account within the rule of law."
The IS group 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.
The victims of the nightclub attack included citizens of Israel, France, Tunisia, Lebanon, India, Belgium, Jordan, and Saudi Arabia.