By Tulay Karadeniz and Nick Tattersall
ANKARA/ISTANBUL (Reuters) - Turkish President Tayyip Erdogan threatened on Friday to unleash a new wave of migrants on Europe after lawmakers there voted for a temporary halt to Turkey's EU membership negotiations, but behind the fighting talk, neither side wants a collapse in ties.
Europe's deteriorating relations with Turkey, a buffer against the conflicts in Syria and Iraq, are endangering a deal which has helped to significantly reduce a migrant influx which saw more than 1.3 million people arrive in Europe last year.
"You clamored when 50,000 refugees came to Kapikule, and started wondering what would happen if the border gates were opened," Erdogan said in a speech in Istanbul, referring to a Bulgarian border checkpoint where migrants massed last year.
"If you go any further, these border gates will be opened. Neither I nor my people will be affected by these empty threats," he told a women's conference, dismissing Thursday's vote in the European Parliament in Strasbourg.
"Don't forget, the West needs Turkey."
The agreement struck in March with Ankara, under which it helps control migration in return for the promise of accelerated EU membership talks and aid, has reduced the influx via Turkey to a trickle. But its neighbors are still struggling to cope.
Clashes broke out at a migrant camp on the Greek island of Lesbos after a fire killed a woman and a 6-year old child late on Thursday, while Bulgaria said it would extradite hundreds of asylum seekers to their native Afghanistan next month after they clashed with riot police.
The vote by the European Parliament in favor of freezing Turkey's EU accession talks was non-binding and Germany, France and most other EU states back continued engagement, despite their concerns about Turkey's human rights record.
European leaders fear putting at risk Erdogan's cooperation on migration at a time when far-right and anti-immigrant parties have seen their popularity rise, particularly with elections next year in France, Germany and Holland.
Sensing Europe's weakness, Erdogan has repeatedly threatened in recent days that Turkey could "cut its own umbilical cord" and sever ties with the EU, playing migration as his trump card.
But Turkey also needs Europe. The EU is Turkey's largest trading partner and its 11-year membership negotiations, though long stalled, served in their early years as an important anchor for pro-market reforms and investor confidence.
"Cutting off membership talks would harm both sides. We are aware of this," said Yasin Aktay, a spokesman for the ruling AK Party, which was founded by Erdogan.
"We support the continuing of relations, we know this will benefit us and them. But if there is a negative step from the other side, we will not be held responsible for the consequences," he said.
Erdogan is riding a wave of nationalist sentiment after a failed military coup in July, and his emotional criticism of Europe plays well to a domestic audience angered by what it saw as lackluster Western support for Turkey after the attempt.
The European Parliament voted for freezing talks because of what it saw as Turkey's "disproportionate" reaction to the coup. More than 125,000 people accused of links to the plotters, from soldiers and judges to journalists and doctors, have been dismissed or detained over the past four months.
"There are millions of migrant babies across the world ... but no step is being taken. What step is being taken? Debating whether or not Turkey should be in the EU," Erdogan said.
"We are the ones who feed 3 million refugees. You have not even kept your promises."
Turkey is home to the world's largest refugee population, housing some 2.7 million Syrians and 300,000 Iraqis. Erdogan has repeatedly said that promised European aid has been too slow to arrive, a charge rejected by Brussels.
He has said Turkey could hold a referendum on whether or not to continue its EU membership bid, and even floated the idea of becoming a member of the Shanghai Cooperation Organisation, a security bloc dominated by China and Russia.
"This is extremely populist rhetoric," said Sinan Ulgen, a former Turkish diplomat and analyst at Carnegie Europe.
The Shanghai grouping was formed with security, not trade, at its core and can be no substitute for the EU, he said.
"There is no diplomatic preparation to form an alternative relationship with the EU other than full membership at the moment," he said, adding that there was a high chance of a diplomatic crisis over the migration deal by year-end.
"It is difficult for the migration agreement to continue under these circumstances," he said.
Under the March deal, Turkey agreed to take back illegal migrants leaving its shores for Greece in return, among other things, for visa-free travel for Turks in Europe. Such visa liberalization looks unlikely to be granted any time soon.
Several EU members nonetheless made clear on Friday they were against freezing Turkey's negotiations to join the bloc.
"It is important that we keep talking," German Foreign Ministry spokeswoman Sawsan Chebli told a news conference.
Croatian Foreign Minister Davor Ivo Stier said it was not in the interests of the EU, Croatia, or Slovenia, where he was on an official visit, to suspend talks with Turkey and that "we need a balanced standpoint toward Ankara".
Before the Balkan migration route was closed in March hundreds of thousands of migrants passed through Croatia and Slovenia toward wealthier western Europe. Both want to keep their borders closed for illegal migrants.
But France criticized Erdogan for threatening Europe.
"We believe one-upmanship and controversies are counterproductive," French foreign affairs ministry spokesman Alexandre Giorgini said at a news briefing.
(Additional reporting by Ercan Gurses and Tuvan Gumrukcu in Ankara, Daren Butler in Istanbul, Angeliki Koutantou and Renee Maltezou in Athens, Dimitar Kyosemarliev in Harmanli, Paul Carrel in Berlin, Marja Novak in Paris, Writing by Nick Tattersall, Editing by Angus MacSwan)