The Turkish vice consul to Iraq's autonomous Kurdish region was among at least two people shot dead Wednesday in the regional capital Arbil, prompting pledges of "retaliation" from Ankara.
No group has claimed responsibility for the attack so far, but Turkey is already waging a fierce offensive against Kurdistan Workers' Party (PKK) bases in northern Iraq.
On Wednesday afternoon, at least one gunman fired on Turkish consulate workers in a restaurant in Ainkawa, a northern Arbil neighbourhood that hosts numerous restaurants and the Turkish consulate.
"A shooting in front of a restaurant in Arbil left a Turkish consulate employee and a civilian dead, and wounded a third person," said the Kurdish internal security forces, known as the Asayish.
The diplomat was identified by a local police source to AFP as the Turkish vice consul. The source said the attacker fled the scene.
A spokesman for the Iraqi foreign ministry confirmed the incident and condemned the attack.
Turkey's foreign ministry said an "employee" at its Arbil consulate was killed in a shooting outside the consulate.
"We are continuing our efforts with the Iraqi government and local authorities to find the perpetrators of this attack as quickly as possible," said Turkish President Recep Tayyip Erdogan.
His spokesman Ibrahim Kalin vowed "the necessary response will be given to those who committed this treacherous attack."
- 'Heinous' attack -
The Kurdistan Democratic Party (KDP), which now leads the regional government, enjoys good political and trade relations with Turkey.
But one sticking point is the PKK, which operates rear bases across Iraq's mountainous north.
The PKK is classified as a "terrorist" group by Turkey, the United States and the European Union because of the three-decade insurgency it has waged against the Turkish state.
Turkey has been conducting a ground offensive and bombing campaign since May in the mountainous northern region to root out PKK pockets.
Earlier this month, the PKK announced that one of those raids killed senior PKK leader Diyar Gharib Mohammed along with two other fighters.
A spokesman for the PKK's armed branch denied the group was involved in Wednesday's shooting.
According to Turkish state media, the attacker was dressed in plain clothes and carried two guns when he stormed the restaurant in Ainkawa, a bustling northern district of Arbil.
Witnesses in the city said checkpoints had been quickly set up inside and around the neighbourhood.
The US embassy slammed the attack as "heinous" and offered its condolences to the Turkish mission, calling for "the defence and safety of foreign diplomats and diplomatic missions in Iraq."
Several rocket attacks have targeted diplomatic missions in Iraq in recent months, including near the US and UK embassies in Baghdad's "Green Zone."
The US in May ordered all non-essential personnel of its Baghdad embassy and Arbil consulate to leave the country.
And in June, protesters gathered outside the Bahraini embassy in Baghdad.
Authorities in Iraq, which is witnessing a period of relative calm since declaring victory against the Islamic State group in 2017, have pledged to protect embassies.