Istanbul (AFP) - President Recep Tayyip Erdogan threatened Friday to walk away from a deal that has substantially reduced the flow of migrants to the European Union and also effectively end Ankara's membership bid by bringing back capital punishment.

Erdogan's warning he could open Turkey's borders to illegal migrants bound for Europe prompted an immediate objection from Germany that such "threats" were unhelpful.

Greece, which would face a heightened influx of migrants if Turkey made good its threat, also expressed "concern" at what it said would be "an act of aggression."

The Turkish leader's comments came a day after the European Parliament angered Ankara by backing a freeze of its EU accession talks, already hit by alarm over its crackdown in the wake of a failed coup in July.

"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.

At a later meeting, Erdogan reaffirmed he would sign a law bringing back the death penalty if it is approved by parliament.

"If the people say 'we want the death penalty'... and this goes to parliament and parliament passes it and it comes to me, I declare I will approve this," he added.

EU officials have repeatedly made clear that bringing back the death penalty would instantly end Turkey's bid for membership as abolishing capital punishment is a key precondition.

- 'Promises unfulfilled' -

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.

Story continues

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 the 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, German 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".

Greece's Deputy Defence Minister Dimitris Vitsas said that "using refugees and migrants to achieve other objectives (than those related to managing the influx) is an act of aggression".

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

Erdogan 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.

Erdogan said while Turkey itself was looking after three million refugees -- including 2.7 million Syrians who escaped the civil war but also Iraqis -- "you (the EU) did not fulfil your promises".

- 'Not a reality' -

The European Parliament vote to freeze the accession talks reflected spiralling tensions with Ankara after Brussels repeatedly expressed alarm over the magnitude of Turkey's crackdown after the coup attempts as well as the threats to bring back capital punishment.

The parliamentary vote is non-binding and earlier this month, all EU foreign ministers -- with the exception of Austria -- said they favoured 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 forward.

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".