ANKARA, Turkey (AP) — Turkish President Recep Tayyip Erdogan threatened on Thursday to scrap a deal with the European Union to readmit migrants who have crossed illegally into Europe, amid a standoff with European nations over their reluctance to allow Turkish ministers to hold campaign rallies in their countries.

In a feisty campaign speech in northwest Turkey, Erdogan said the EU could “forget about” the deal, in which Ankara agreed to readmit migrants that had reached Greece illegally via Turkey — a key transit country for tens of thousands trying to flee fighting and poverty and enter Europe. In return, the EU was to grant Turkish citizens the right to travel to many European countries visa-free.

The comments were the latest in Turkey’s bitter diplomatic spat with Germany and the Netherlands, which last week prevented two Turkish ministers from addressing Turkish citizens in Rotterdam in the lead-up to a referendum on constitutional reforms that would increase Erdogan’s powers. One minister was escorted out to the country, while the other was denied permission to land. Some German authorities have also blocked appearances by Turkish ministers trying to attend similar rallies.

On Thursday, Erdogan reiterated angry criticism of the ban. He also accused the EU of not sticking to a promise to grant Turkish nationals the right to travel visa-free in Europe.

“Now they’re talking about the readmission agreement. What readmission? Forget about it,” he said, referring to the migrant deal. The agreement, which was initially reached in 2013, was revived last year, when Turkey agreed to help keep migrants from crossing into the EU in return for funds to help it deal with some 3 million refugees.

“You bar my minister from entering the Netherlands … and then you expect us to grant access (to migrants)? There can be no such thing,” he added.

In Greece, officials did not immediately react to Erdogan’s comments. But responding to a similar threat by Turkish Foreign Minister Mevlut Cavusoglu earlier, Greece’s deputy defense minister said it was unclear whether Turkey was really proposing to end the deal.

“The refugee issue is a matter of international law, international solidarity and a humanitarian concern,” Dimitris Vitsas told the private Alpha radio Thursday. “When it is used at a level of rhetoric, and much more at a practical level, as a negotiating weapon, then we are no longer talking about the refugee issue.”

“But I must point out that many things are being said right now ahead of the forthcoming referendum in Turkey,” he added.

Erdogan also sharply criticized a European court ruling in favor of curbs on wearing Islamic headscarves, renewed accusations of “Neo-Nazism” against the Netherlands, and remarked that the Dutch Prime Minister Mark Rutte had lost Turkey’s friendship despite winning elections there.

“What happened to your freedom to faith and religion,” Erdogan said. “They have started a (Christian-Muslim) war. There can be no other explanation. I say this very openly, Europe is heading toward its pre-World War II days.”

Erdogan ruled out any possibility of reconciliation with a new Dutch government to be headed by Rutte.

“Oh Rutte, you may have come out (of the elections) as the first party, but you should know that you have lost a friend like Turkey,” he said.

Meanwhile, Chancellor Angela Merkel’s office said the German leader discussed the tensions between EU nations and Turkey with French President Francois Hollande in a phone call Thursday. The two reiterated that Erdogan’s insulting comments about Germany and other European countries — including “Nazi” comparisons — were unacceptable.

Hollande stressed France’s solidarity with Germany and other EU partners that Turkey has assailed, a German government statement said.

The two leaders agreed that appearances by Turkish politicians in Germany and France can be approved — but only if they are “registered in good time and transparently, and adhere strictly to German or French law.”