His fiery speech will be a blow to any hope in European capitals that it might be business as usual with Turkey after Prime Minister Ahmet Davutoglu, who negotiated the migration deal with Europe and had largely delivered on Turkey's commitments so far, announced he was standing down.
The EU asked member states on Wednesday to grant visa-free travel to Turks in return for Ankara stopping migrants reaching Europe, but said Turkey still had to change some laws first, including bringing its terrorism laws in line with EU standards.
Turkish PM Davutoglu bows out as Erdogan aims at stronger presidency
"When Turkey is under attack from terrorist organisations and the powers that support them directly, or indirectly, the EU is telling us to change the law on terrorism," Erdogan said in a speech at the opening of a local government office in the conservative Istanbul district of Eyup.
"They say 'I am going to abolish visas and this is the condition.' I'm sorry, we're going our way, you go yours. Agree with whoever you can agree," he said.
Erdogan is aware that visa-free travel is for many Turks the biggest benefit of Ankara's deal with the EU.
Davutoglu's departure consolidates the power of Erdogan, who has been highly critical of the EU in the past and who is seen in Brussels as a far tougher negotiating partner less closely wedded to Turkey's ambition of joining the EU in recent years.
Turkey won't hold election after ruling party changes leader - presidential adviser
To win visa-free travel, 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.
But Ankara insists the laws are essential as it battles Kurdish militants at home and the threat from Islamic State in neighbouring Syria and Iraq.
"It's not possible to make any revision to the legislation and practices on terrorism while our country continues its intense fight against various terrorist organisations," EU Minister Volkan Bozkir was earlier quoted as saying by the Daily Sabah on Thursday.
He said Turkey had already made some changes requested by Europe, including reference to "the concept of immediate and obvious danger that threatens public security", and that Turkey "does not have the luxury" of making any more.
A German government spokesman said Berlin expects Turkey to uphold the deal, which was pushed by Chancellor Angela Merkel and which she hopes will shore up support for her conservatives ahead of a federal election next year.
Hard act to follow?
Erdogan bristles at suggestions that Turkey uses its anti-terrorism laws indiscriminately.
He has repeatedly stressed his determination to crush Kurdish militants fighting an insurgency in Turkey's southeast, and is unlikely to sanction Ankara backing down on the European demands.
Turkey army ridicules talk of 'anti-Erdogan coup'
Much may depend on the ability of whoever replaces Davutoglu, a decision to be made at an extraordinary congress of the ruling AK Party on May 22, to convince European allies that Turkey has already done enough.
Transport Minister Binali Yildirim, a close Erdogan ally, appears to be the president's current preference, three senior AKP officials said, although they said that could still change.
Government spokesperson Numan Kurtulmus and Justice Minister Bekir Bozdag, also Erdogan loyalists, have been touted, as has Energy Minister Berat Albayrak, Erdogan's son-in-law, sources in the party have said.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ