ANKARA — Turkish President Tayyip Erdogan accused European nations on Tuesday of being safe havens for the political wings of terrorist groups and said it was a “black comedy” for the Europe Union to lecture Ankara on changing its anti-terrorism laws.

His comments will further dampen European hopes that it can be ‘business as usual’ with Turkey following the departure of Prime Minister Ahmet Davutoglu, seen by many in the EU as a more liberal face of the Turkish government after he negotiated a landmark deal with the bloc on migration.

The EU last week asked member states to grant visa-free travel to Turks in return for Ankara stopping migrants reaching Europe, but said Turkey still had to change some legislation, including bringing its terrorism laws into line with EU standards.

Turkish President Tayyip Erdogan attends a meeting of the Union of Chambers and Commodity Exchanges of Turkey (TOBB) in Ankara, Turkey, May 10, 2016. Photo: Presidential Palace/Murat Cetinmuhurdar via Reuters

In a speech in Ankara, Erdogan said the EU should change its own laws on terrorism first and said he hoped Europe would live up to its promise on visa-free travel by October at the latest.

“European countries continue to be safe havens for the political extensions of terrorist groups. When this is the case, it’s a piece of black comedy that the EU criticizes our country over the definition of terrorism,” he said.

“First of all, we expect EU countries to fix their own laws that support terrorism.”

Erdogan is still seething over the presence of protesters sympathetic to the Kurdistan Workers Party (PKK) militant group near an EU-Turkey summit in Brussels in March, which he said at the time demonstrated the EU’s “two-faced” behavior.

The PKK has waged a three-decade insurgency for Kurdish autonomy in Turkey’s southeast, a conflict which has flared anew since the collapse of a ceasefire last July. Turkey, the EU and the United States all consider the PKK a terrorist group.

Erdogan has also in the past accused Belgium of being soft on militant groups and said EU authorities had shown themselves “incapable” after Turkey deported a militant Islamist who was then released. The man was one of the attackers involved in the Islamic State suicide bombings in Brussels in March.

POPULIST OR PRAGMATIST?

Last Friday Erdogan vowed Turkey would not change its terrorism laws and, in a blunt message to Brussels, declared: “We’re going our way, you go yours.”

It was typically populist rhetoric from a leader whose core supporters are often religious and social conservatives, suspicious of Western influence over their leaders.

Beneath the bluster, some diplomats and analysts say, Erdogan remains a pragmatist who knows Turkey’s best interests lie in maintaining cordial relations with the West.

He struck a sharply different tone on Monday in a statement to mark Europe Day, saying EU membership remained a strategic goal for Turkey and would be a “source of stability and inspiration for the region.”

Europe is counting on Turkey to maintain the migration deal that has helped to sharply reduce the flow of refugees and migrants via Turkish shores, which saw more than a million people reach Greece and Italy last year.

Visa-free travel to Europe is for many Turks the main reward in the deal. But to secure it, Turkey must still meet five of 72 criteria the EU imposes on all states exempt from visas, one of which is narrowing its legal definition of terrorism.

Rights groups say Turkey has used broad anti-terrorism laws to silence dissent, including detaining journalists and academics critical of the government. Ankara insists the laws are essential as it battles Kurdish militants at home and the threat from the Islamic State group in neighboring Syria and Iraq.