The EU's top diplomat in Turkey has stepped down after a row with Ankara over his criticism of the government's conduct in a landmark migrant deal, his office said on Tuesday.
The departure of Hansjoerg Haber is indicative of the increasingly-fractious relationship between Ankara and Brussels, even as both sides try and implement a key agreement aimed at reducing the flow of migrants to the European Union.
"We confirm that the ambassador has resigned," a spokesperson told AFP in a move confirmed by the office of EU foreign policy chief Federica Mogherini.
Haber, a German diplomat who headed the EU delegation to Ankara, had come under fire after comments to the media on May 13 in which he bitterly criticised the Turkish government's conduct in implementing the deal.
He had only been in his post since October.
The Turkish foreign ministry said at the time his comments caused "indignation".
Haber said: "We have a saying 'Start like a Turk and end like a German. But here it is the other way round'," Turkish media reported.
His comments were viewed as deeply insulting in Turkey, where ambassadors are generally expected to show extreme respect for Turkish culture.
Volkan Bozkir, who was Turkey's EU affairs minister at the time, said Haber had broken "the first law of diplomacy".
"No ambassador has the right to humiliate the people of the country in which he is working or to say something about its president," he was quoted as saying by the Hurriyet daily.
It said the dispute had upset Mogherini who in the end had wanted Haber to resign. Intervention by Germany was not enough to ease the tensions, it added.
EU commission spokeswoman for foreign policy Maja Kocijancic confirmed the resignation, saying Haber would leave on August 1 and a successor would be swiftly appointed.
She declined to give further details, saying only that "we will continue to work with Turkey" as a key partner and a candidate country.
Turkey has demanded visa-free travel for its citizens to most of the bloc in return for curbing the refugee flow but the deal is now in limbo as Ankara refuses to meet all the criteria laid down by Brussels.
The main sticking point is the EU's demand that Turkey narrow its definition of terror in its anti-terror laws that have been used to justify the arrests of academics and journalists.
But Prime Minister Binali Yildirim said Tuesday that Ankara had no intention of shifting on this issue, at a time when the military is waging an offensive against the outlawed Kurdistan Workers Party (PKK).
"In these conditions there cannot be any discussion of changing the laws on the fight against terror... even if this means the visa deal is at stake," Yildirim told his parliamentary party.
Tension over the visa deal is just one of many issues causing ructions between Ankara and Brussels, including the fight against the PKK, media freedoms and a law stripping Turkish MPs of immunity.
Turkey is also increasingly frustrated at the slow progress in its bid to join the EU, which dates back to 1987.
The European Commission is due Wednesday to publish its second report on the implementation of the EU-Turkey agreement, including elements on the progress regarding the fulfilment of the conditions for visa liberalisation.