Image caption Images of the suspect have already been widely circulated in Turkish media

Turkey has arrested a number of people of Uighur ethnicity over a deadly nightclub attack that killed 39, the state-run news agency reports.

Those detained are believed to have come from China's Xinjiang region with ties to the attacker, Anadolu says.

Deputy PM Veysi Kaynak also said they were closing in on the gunman, who he said was possibly an ethnic Uighur.

Also on Thursday, there was an explosion near the courthouse in the city of Izmir in western Turkey.

Social media images showed two cars ablaze and several people were reported wounded.

Other images showed what appeared to be the body of a man carrying a gun, amid media reports he was an attacker who was shot dead by police.

Anadolu reported a second man was shot dead and police were seeking a third.

'Aiding and abetting'

So-called Islamic State (IS) says it carried out the Istanbul attack over Turkey's military involvement in the Syrian civil war.

The authorities have reportedly tightened security at Turkey's land borders and airports to prevent the attacker from fleeing the country.

Turkish media have run images of a suspect, saying the pictures were handed out by the police. But the police have given no official details.

The Turkish foreign minister has said the authorities have identified the attacker, but has not given further details.

Image copyright Reuters Image caption Turkey has heightened security across the country, including at land borders and airports

Special forces made the early morning arrests at a housing complex in Selimpasa, a coastal town on the outskirts of Istanbul, after police were reportedly tipped off that individuals linked to the attacker were in the area.

Uighurs were among those arrested - the number was not confirmed - on suspicion of "aiding and abetting" the gunman, Anadolu reported.

At least 36 people were already in custody over suspected links to the attack, many of whom were picked up in an earlier police operation in Izmir.

Several families had recently travelled there from Konya, a central city where the main suspect was said to have stayed for several weeks before the attack.

Who are the Uighurs? BBC Monitoring

The Uighurs are a Turkic ethnic group who are mainly Muslims, primarily living in the Xinjiang Uighur Autonomous Region in China. Their language is related to Turkish and a substantial Uighur diaspora lives in Turkey.

Some Uighurs have complained for years about persecution at the hands of the Chinese authorities. Al-Qaeda has long-developed links with Uighur jihadists - known as the Turkestan Islamic Party (TIP) - and has offered them military training in Afghanistan.

Uighur jihadists appear to have joined the fighting in Syria in relatively large numbers, alongside both Jabhat Fateh al-Sham (JFS, formerly al-Qaeda's Syrian branch al-Nusra) and al-Qaeda's rivals, the so-called Islamic State (IS).

They have featured in IS propaganda and the group's magazine, Rumiyah, has been published in Uighur, along with English and a range of other languages.

It is believed Uighurs make their way to Kyrgyzstan through the mountains between Kyrgyzstan and Xinjiang. Once in Kyrgyzstan, they fly to Turkey using forged Kyrgyz passports.

Separately, Mr Kaynak told Turkish broadcaster A Hamer that the authorities knew where the suspect, who he described as "specially trained", was hiding, without giving further details.

He confirmed the gunman had acted alone, but may have had help inside the nightclub.

Image copyright AFP Image caption Some 27 of the 39 killed at Reina nightclub were foreigners

Witnesses to the new year attack said more than 100 rounds of bullets were fired which, the BBC's security correspondent Frank Gardener says, indicates the gunman had at least some rudimentary military training.

Mr Kaynak expressed confidence in the Turkish police operation but said he could not rule out the possibility of the attacker fleeing the country.

No Kyrgyz connection

Previous media reports incorrectly suggested the culprit was a national from Kyrgyzstan, after a passport photo claiming to show the attacker was circulated.

It later emerged the passport belonged to someone unrelated to the attack.

Kyrgyzstan's embassy in Turkey has since asked the media to retract the reports and issue an apology.

Media playback is unsupported on your device Media caption The BBC's Mark Lowen was one of the first journalists allowed into the nightclub site

More than half of those killed in Sunday's attack on Istanbul's popular Reina nightclub were foreigners, including citizens from Lebanon, Saudi Arabia, Israel, Iraq and Morocco.

The gunman managed to escape in the aftermath of the attack.

A day later, IS issued a statement saying "a heroic soldier" belonging to the group had carried out the attack in retaliation for Turkey's military role in northern Syria.

Mr Kaynak also said on Thursday Turks were questioning the use of the country's Incirlik air base by both Nato and the US-led coalition launching air strikes on IS in Syria and Iraq.

Turkey launched a military operation in Syria in August to push back IS and Kurdish forces.

Some of Turkey's big cities have since been targeted in a number of bomb attacks by IS and by Kurdish militants.