Istanbul (Reuters): Turkish police have captured the gunman who killed 39 people in an Istanbul nightclub on New Year 's Day at a hideout in an outlying suburb of the city after a two-week manhunt, officials said on Tuesday.

Istanbul Governor Vasip Sahin named the man as Abdulgadir Masharipov and said he was born in 1983 in Uzbekistan and received training in Afghanistan.

Masharipov, who was captured with four others overnight, had admitted his guilt and his fingerprints matched those at the scene, Sahin said. "He knew four languages and was well-educated," Sahin told a news conference. There were strong indications he entered Turkey illegally through its eastern borders in January 2016 and it was clear the attack was carried out on behalf of Islamic State, Sahin said.

The terrorist group claimed responsibility a day after the mass shooting, saying it was revenge for Turkish military involvement in Syria. Masharipov was captured with an Iraqi man and three women from Africa, one of them from Egypt, in the Esenyurt district on Istanbul 's western outskirts, about 30 km (19 miles) from the Reina nightclub.