ISTANBUL — A Turkish diplomat and two Iraqis were killed Wednesday in a gun attack in a restaurant in the Kurdish-controlled region of Iraq, according to the Turkish and Iraqi governments.

Turkey’s foreign minister, Mevlut Cavusoglu, confirmed the death of an official of the Turkish Consulate, and said that one Iraqi had been killed and another seriously wounded. The second Iraqi died later.

The two Iraqis worked for the consulate, said Dr. Ahmed al-Sahaf, an Iraqi Foreign Ministry spokesman. One was a guard for the Turkish diplomat.

It was not immediately clear who carried out the shooting or why. Iraqi and Turkish authorities said they were investigating the attack.