Erdogan's comments, some of his toughest in recent times against the European Union, prompted an immediate warning from Germany which helped broker the deal that such “threats” were unhelpful.
The threat came a day after the European Parliament angered Ankara by backing a freeze in EU accession talks, already hit by alarm over its crackdown in the wake of the July 15 failed coup.
“Listen to me. If you go any further, then the frontiers will be opened, bear that in mind,” Erdogan told the EU during a speech in Istanbul.
He said Brussels had cried out for help in 2015 as tens of thousands of migrants massed at Turkey's border crossing with EU member Bulgaria.
“You began to ask us 'what will we do if Turkey opens its borders'?” he asked.
On March 18, Ankara and Brussels forged a deal for Turkey to halt the flow of migrants to Europe — an accord that has largely been successful in reducing numbers crossing the Aegean Sea between Turkey and Greece.
According to the International Organization 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.
Hundreds of migrants drowned while trying to cross the Aegean in 2015 on unseaworthy boats, including three-year-old Syrian Aylan Kurdi. The images of his lifeless body washed up on a Turkish beach spurred the international community into action.
Turkey agreed to step up maritime and land border controls in exchange for incentives on its long-stalled membership bid, including visa-free travel for its citizens and an acceleration of accession talks.
However with an October target passing, no apparent progress on the visa issue and the accession talks stalled, Ankara has accused Brussels of failing to keep its side of the bargain.
In response to Erdogan's remarks, Chancellor Angela Merkel's spokeswoman Ulrike Demmer said the deal was in the interest “of all parties” and that “threats on either side are not helpful”.
EU Commission spokesman Margaritis Schinas said it would not get involved in “statements about hypothetical scenarios” and was still committed to implementing the agreement.
But 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.”
Erdogan said while Turkey itself was looking after three million refugees — mainly 2.7 million Syrians from the civil war, but also Iraqis — but “you (the EU) did not fulfil your promises”.
“You never acted honourably,” he told the bloc.
He has also accused Brussels of failing to fulfil a promise to deliver some six billion euros ($6.3 billion) in aid for refugees.
The EU says the money is to be transferred gradually for individual projects and not in a single payment.
'Not a reality'
The European Parliament vote reflected spiralling tensions with Ankara after Brussels repeatedly expressed alarm over the magnitude of Turkey's crackdown after the coup. Turkey in turn accused Brussels of failing to show solidarity.
The 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.
But analysts say the entire membership process is in deep trouble, with little hope of progress and several risk factors that could lead to its collapse.
“Realistically, moving forward is also nearly impossible… Both Brussels and Ankara remain stuck and are playing for time,” Asli Aydintasbas of the European Council on Foreign Relations (ECFR) said in a research paper.
She suggested an alternative form of engagement between Turkey and the EU, other than full membership, could be agreed to save face and move forwards.
“In reality, most officials privately concede that full membership is not a possibility at this point,” she said.
Austria's Foreign Minister Sebastian Kurz, a hardliner on Turkey, said Europe should strengthen its own borders after Erdogan's comments and “must not give into blackmail”.
By Stuart WILLIAMS/AFP