ISTANBUL, Jan. 17 (Xinhua) -- Istanbul police on Monday night captured the gunman who launched a shooting spree at a nightclub in the city on New Year's Day, killing 39 people, local media reported.

The gunman, who has been on the run for 17 days, was caught unharmed at the apartment of a friend in the district of Esenyurt in a police operation, the Hurriyet daily said.

Police have identified him as Abdulgadir Masharipov, a Uzbek national, who resisted during the operation and was found with his 4-year-old son, NTV said.

Masharipov will undergo a medical examination before being handed over to the counter-terrorism unit for investigation, the reports said.