President Recep Tayyip Erdogan has warned Turkey could open its border for refugees to stream into Europe after EU MEPs voted for a temporary halt to membership talks.

Speaking at a congress on womens' justice in Istanbul, the president warned: "If you go any further, these border gates will be opened. Neither me nor my people will be affected by these dry threats. It wouldn't matter if all of you approved the vote".

He said the EU had "wailed" for help controlling the flow of refugees and migrants in 2015 and the bloc worried what would happen if Turkey opened its borders. Mr Erdogan made specific reference to Turkey's main border crossing with EU member Bulgaria.

MEPs voted 479 in favour of halting long-term membership talks with Ankara at a plenary session in Strasbourg on Thursday amid concerns about the brutal crackdown on political dissidents since a failed coup in July.

The talks were part of a wide-ranging deal agreed with Mr Erdogan's government which meant Turkey would shelter the thousands of refugees fleeing violence in Iraq and Syria in exchange for aid, membership talks and visa-free travel for its citizens.

The deal – struck in March – means that for every refugee arriving in Europe who is repatriated back to Turkey, EU countries will resettle another from Turkish refugee camps in a "one in, one out" system.

The accord has largely been successful in reducing numbers crossing the Aegean Sea between Turkey and Greece. According to the International Organisation for Migration (IOM), just over 171,000 have crossed to Greece so far this year, much lower than the comparable figure for 2015 of almost 740,000.

However while the number of refugees attempting boat journeys across the Aegean Sea has slowed to a trickle, thousands have continued to cross the Mediterranean from Libya.

The treacherous passage has claimed the vast majority of more than 4,600 lives lost so far this year in sea journeys to Europe, making 2016 the deadliest year on record.

In pictures: Turkey coup attempt Show all 17 1 /17 In pictures: Turkey coup attempt In pictures: Turkey coup attempt Turkish President Erdogan attends the funeral service for victims of the thwarted coup in Istanbul at Fatih mosque on July 17, 2016 in Istanbul, Turkey Burak Kara/Getty Images In pictures: Turkey coup attempt Soldiers involved in the coup attempt surrender on Bosphorus bridge with their hands raised in Istanbul on 16 July, 2016 Gokhan Tan/Getty In pictures: Turkey coup attempt A civilian beats a soldier after troops involved in the coup surrendered on the Bosphorus Bridge in Istanbul, Turkey, 16 July, 2016 REUTERS/Murad Sezer In pictures: Turkey coup attempt Surrendered Turkish soldiers who were involved in the coup are beaten by a civilian Reuters In pictures: Turkey coup attempt Soliders involved in the coup attempt surrender on Bosphorus bridge Getty In pictures: Turkey coup attempt Supporters of Turkish President Recep Tayyip Erdogan wave flags as they capture a Turkish Army vehicle Getty In pictures: Turkey coup attempt People pose near a tank after troops involved in the coup surrendered on the Bosphorus Bridge in Istanbul, Turkey, 16 July, 2016 Reuters In pictures: Turkey coup attempt Turkish soldiers block Istanbul's Bosphorus Brigde Getty In pictures: Turkey coup attempt A Turkish military stands guard near the Taksim Square in Istanbul Reuters In pictures: Turkey coup attempt Pierre Crom/Twitter In pictures: Turkey coup attempt Turkish soldiers secure the area as supporters of Recep Tayyip Erdogan protest in Istanbul's Taksim square AP In pictures: Turkey coup attempt People demonstrate in front of the Republic Monument at the Taksim Square in Istanbul Murad Sezer/Reuters In pictures: Turkey coup attempt Turkish soldiers detain police officers during a security shutdown of the Bosphorus Bridge Reuters In pictures: Turkey coup attempt Turkish Army armoured personnel carriers in the main streets of Istanbul Getty In pictures: Turkey coup attempt Chaos reigned in Istanbul as tanks drove through the streets EPA/TOLGA BOZOGLU In pictures: Turkey coup attempt Turkish President Tayyip Erdogan speaks to media in the resort town of Marmaris Reuters In pictures: Turkey coup attempt Supporters of President Erdogan celebrate in Ankara following the suppression of the attempted coup Reuters

The controversial agreement was designed to ease the pressure on European political leaders after they began to be seen as powerless to control their own borders.

In response to Mr Erdogan's remarks, Ms Merkel's spokeswoman Ulrike Demmer said the deal was in the interests “of all parties” and that “threats on either side are not helpful”

France also criticised Mr Erdogan for threatening Europe. “We believe one-upmanship and controversies are counterproductive,” French foreign affairs ministry spokesman Alexandre Giorgini said.

EU Commission spokesman Margaritis Schinas said it would not get involved in "statements about hypothetical scenarios" and was still committed to implementing the agreement.

However, the European Parliament's rapporteur on Turkey, Kati Piri, tweeted that "linking (the) deal on migration with (the) EU accession talks was wrong from the beginning."

Mr Erdogan said that while Turkey itself was looking after three million refugees – mainly 2.7 million Syrians from the civil war – but he accused the EU of having "never acted honourably" in their dealings with Turkey.

He has also accused Brussels of failing to fulfil a pledge to deliver some €6bn (£5.2bn) in aid for refugees.

“We have been given $550m (£442m) by the United Nations," he said. "The European Union promised, but the money it has sent so far is around $700m. But what have we spent? Up to now we have spent $15bn.”

The EU says the money is to be transferred gradually for individual projects – not as a single payment.

The negotiations for Turkey's potential accession to the EU have been underway since 2005, but European leaders have warned that Ankara is unlikely to be permitted to join if Mr Erdogan restores the death penalty following the attempted coup earlier this year. Mr Erdogan says he supports the move, but it would need parliamentary approval.

So far around 70,000 people have been arrested and thousands more have been sacked from their jobs in schools, the judiciary and the police following the failed coup, during which soldiers took over the state broadcaster and blockaded Istanbul's main airport.

Mr Erdogan accused supporters of his former ally, Fethullah Gulen, of organising the coup against him, and arrested several members of his family – though the Pennsylvania-based cleric has denied any involvement.

The EU parliamentary vote is non-binding and earlier this month, all EU foreign ministers – with the exception of Austria – said they were in favour of continuing the accession talks.

Germany's Foreign Ministry said on Friday, that it was "important" that the two sides "keep talking".

“It is important that we do not freeze the accession negotiations because that would only further damage the relationship between Turkey and Europe, and that would not be in the interest of Turkey or of Europe,” Foreign Ministry spokeswoman Sawsan Chebli said.