ANKARA (Reuters) - Suspected Kurdish militants clashed with police and detonated a car bomb in western Turkey on Thursday after their vehicle was stopped at a checkpoint, killing a police officer and a court employee, officials said.The explosion and gunfire outside the main courthouse in Izmir, Turkey's third largest city, highlighted the country's deteriorating security five days after a gunman killed 39 people in a New Year's Day mass shooting at an Istanbul nightclub.

Deputy Prime Minister Veysi Kaynak said a much larger attack was apparently being planned, based on the weapons found at the scene in Izmir, which is located on the Aegean coast. The local governor said the arms included Kalashnikov rifles, hand grenades and ammunition for rocket-propelled grenade launchers.

"Based on the preparation, the weapons, the bombs and ammunition seized, it is understood that a big atrocity was being planned," Kaynak told reporters.

Izmir police shot dead two of the attackers and were hunting a third, a police source and the state-run Anadolu agency said.

People react after an explosion outside a courthouse in Izmir, Turkey, January 5, 2017.

People holding a Turkish flag gather near the scene after an explosion outside a courthouse in Izmir, Turkey, January 5, 2017.

Medics arrive at the scene after an explosion outside a courthouse in Izmir, Turkey, January 5, 2017.

Two people, believed to have sold the vehicle used in the attack to the assailants, were subsequently detained, security sources said.Initial findings suggested that Kurdistan Workers Party (PKK) militants were behind the attack, Izmir governor Erol Ayyildiz said.

He said a second vehicle had been detonated in a controlled explosion. Anadolu said police suspected the attackers had planned to escape in this vehicle.

NATO member Turkey is part of the U.S.-led coalition fighting Islamic State in Syria and is also battling an insurgency by the PKK in the largely Kurdish southeast.

It regularly bombs PKK camps in northern Iraq and its military operations in Syria also aim to stop Kurdish militias it sees as an extension of the PKK from gaining territory there.

"Turkey will be instrumental in its region. These (attacks) will never prevent us from being present in areas like Iraq and Syria, which produce terrorists like viruses," Kaynak said.

INCREASINGLY DEADLY ATTACKS

Ayyildiz said the clash outside Izmir's main Bayrakli courthouse erupted after police officers tried to stop a vehicle at a checkpoint and that the attackers detonated the car bomb while trying to escape.

The PKK - deemed a terrorist organization by Turkey, the United States and European Union - and its affiliates have been carrying out increasingly deadly attacks over the past year and a half, ever further from the largely Kurdish southeast, where they have fought an insurgency for more than three decades.

A PKK offshoot claimed responsibility for twin bombings that killed 44 people, most of them police officers, and wounded more than 150 outside an Istanbul soccer stadium on Dec. 10.

A car bomb a week later killed 13 soldiers and wounded 56 when it tore through a bus carrying off-duty military personnel in the central city of Kayseri, in an attack President Tayyip Erdogan also blamed on Kurdish militants.

There was no immediate claim of responsibility for the attack in Izmir, a liberal coastal city which had largely escaped the violence that has plagued Istanbul and the capital Ankara in recent months.

Police detained 20 suspected Islamic State militants thought to be of Central Asian and North African origin in Izmir on Wednesday, in raids Turkish media said were linked to the Istanbul nightclub attack.

Two people were killed in an explosion Thursday near a courthouse in the city of Izmir in western Turkey, the country's state-run Anadolu news agency reports.

A police officer and a courthouse staff member died in the attack and five others were wounded, the agency said.

Police killed two assailants, according to Izmir Gov. Erol Ayyildiz, who blamed the militant Kurdistan Worker's Party, or PKK, for the attack.

Police had stopped a suspicious vehicle at a checkpoint in front of the courthouse, which led to an armed clash between attackers and security forces, Ayyildiz said. During the clash, the attackers "detonated a car bomb as they tried to escape," he told reporters.

The attackers were armed with Kalashnikov rifles and grenades, Ayyildiz said.

Fethi Sekin, a 43-year-old police officer who had worked at the Izmir courthouse for nine years, noticed the attackers and prevented their car from reaching the entry, the state news agency reported.

He pulled his weapon and chased the attackers as they escaped from the vehicle. He killed one of the attackers, but died during the clash, according to Anadolu.

Officials: Larger attack may have been plannedTurkey's Deputy Prime Minister Veysi Kaynak told reporters weapons found by security forces after the explosion suggested a larger attack had been planned.

"If you look at the preparation, ammunition and guns, you understand that they were targeting a big destruction but it did not happen."

He credited the "well trained" police and theorized that the PKK or ISIS could have been responsible. At the scene, police defused a "suspicious car" believed to belong to the attackers in a controlled explosion, according to Anadolu.

Who were the attackers?In the aftermath of the attack, Anadolu initially reported two suspected attackers were killed and a third was at large, but it's not clear if there is another suspect.

"There might be or there might not be but because of the possibility we are looking for him, and if there is one, he will be caught," Ayyildiz told reporters.

Police detained two people related to the Izmir attack, according to Anadolu. It was unclear if either is the potential suspect at large.

The US Embassy in Turkey condemned the attack and vowed to stand with the Turkish people in fighting terror. It tweeted a message that translates to "sorry for your loss."

Izmir, a busy port on the Aegean Sea, is Turkey's third-largest city, home to more than 2 million people.

High alertTurkey is still reeling from the New Year's attack on an Istanbul nightclub that left 39 people dead.

According to Anadolu, at least 69 others were hurt in the shooting rampage. The gunman remains at large.

Police have detained 34 suspects, as well as others picked up in raids Thursday, the news agency reported.

ISIS claimed responsibility for the attack in a statement posted to Twitter, but CNN cannot independently verify the claim. The terror group boasted of carrying out the first major terrorist attack of 2017.

Growing ThreatEarlier this week, Interior Minister Suleyman Soylu told lawmakers that Turkish security forces had prevented 339 major terror incidents in 2016, 80 of which came in the final three months of the year.

In his speech to Parliament, Soylu cited attacks launched by the PKK, as well as those by Daesh, the Arabic term for ISIS.

Anadolu quoted Soylu as saying that "313 of the incidents were planned by PKK, 22 by Daesh and four by radical leftist groups."

He said 247 improvised explosives and 61 bomb vehicles had been seized in 12 months.

He also revealed the capture of 23 suicide bomber suspects as well as 42 terrorist group members who were preparing for attacks.

Two killed in car bombing in Turkey

Suspected Kurdish militants on Thursday opened fire at police who stopped them at a checkpoint in the western Turkish city of Izmir before detonating their car in front of a courthouse and escaping, Gov. Erol Ayyildiz said.

A police officer and a court employee were killed in the attack, according to state-run Anadolu news agency. Ayyildiz said “six or seven” people were also wounded in the attack.

“The information so far suggests it is the (Kurdish Workers' Party) PKK. Such a conclusion was reached after we assessed the attack and ID’d the people,” Ayyildiz said, according to The Associated Press.

After the explosion, police shot dead two suspected assailants and were searching for a third, Reuters reported.

Ayyildiz said the attackers were carrying two automatic rifles, rocket launchers and eight hand grenades, the AP reported.

The incident comes as Turkey is on high alert following a nightclub attack in Istanbul during New Year’s celebrations that left 39 people dead. The Islamic State group claimed responsibility for that attack. The suspected attacker has not been captured.

Turkey said it has identified the suspected gunman who opened fire on the crowded nightclub, but it has not named him. Police have released a photo of the suspect. Authorities believe he may be from Central Asia or a Chinese Uighur, a Muslim ethnic group.