Ankara (AFP) - Turkish President Recep Tayyip Erdogan told the EU and US to "mind your own business" after the West expressed alarm over the growing crackdown against suspected coup plotters, as a court placed 17 journalists under arrest.

Turkey has detained more than 18,000 people over the coup which Ankara blames on the US-based preacher Fethullah Gulen, with the relentless crackdown sparking warnings from Brussels that its EU membership bid may be in danger.

"Some people give us advice. They say they are worried. Mind your own business! Look at your own deeds," Erdogan said in a speech Friday at his presidential palace.

"Not a single person has come to give condolences either from the European Union... or from the West," said Erdogan.

"And then they say that 'Erdogan has got so angry'!" he fumed.

"Those countries or leaders who are not worried about Turkey's democracy, the lives of our people, its future -- while being so worried about the fate of the putschists -- cannot be our friends."

Erdogan vowed to take all steps "within the limits of the law" as Turkey seeks legal retribution for the perpetrators of the coup.

A Turkish official said 3,500 of those detained have now been released after questioning.

- 17 journalists arrested -

EU enlargement commissioner Johannes Hahn said he needed to see "black-and-white facts about how these people are treated".

"And if there is even the slightest doubt that the (treatment) is improper, then the consequences will be inevitable," he told German daily Sueddeutsche Zeitung.

Turkey has also targeted journalists accused of links to Gulen, causing further international alarm.

Twenty-one detained suspects Friday appeared in front of a judge in Istanbul to decide whether to remand them in custody.

After a hearing lasting to midnight, four were freed but 17 placed under arrest ahead of trial, charged with "membership of a terror group", the state-run Anadolu news agency said.

Those held include the veteran journalist Nazli Ilicak as well as the former correspondent for the pro-Gulen Zaman daily Hanim Busra Erdal, it added.

Among the four freed was prominent commentator Bulent Mumay.

Foreign Minister Mevlut Cavusoglu defended the detention of reporters, saying it was necessary to distinguish between coup plotters and those "who are engaged in real journalism".

The probe into coup plotters widened its scope to the financing of Gulen's activities in Turkey, with what appeared to be the first major arrests targeting the business world.

Security forces in the central city of Kayseri detained the chairman of the prominent family-owned Boydak Holding company, Mustafa Boydak, and two other top executives, Anadolu said.

- 'Cleaned out all elements' -

The president also announced that as a gesture of goodwill after the coup he was dropping hundreds of lawsuits against individuals accused of insulting him.

"I am going to withdraw all the cases regarding the disrespectful insults made against me," said Erdogan.

The authorities had said earlier this year that over 2,000 people were being prosecuted on charges of insulting the president.

Speaking at the same event to remember the "martyrs" of July 15, Prime Minister Binali Yildirim said Turkey has succeeded in eradicating all elements linked to Gulen from the military after sacking nearly half of its generals following the failed coup.

"We have cleaned out from the military the FETO elements who disguised themselves as soldiers," said Yildirim. Turkey accuses Gulen of running the Fethullah Terror Organisation (FETO), charges he denies.

"We are going to make our armed forces stronger and we are going to work towards making this country more secure."

Turkey implemented a shake-up of the military on Thursday after nearly half of its 358 generals were sacked for complicity in the coup.

Both Yildirim and Erdogan were seen on television during the ceremony weeping as the July 15 victims were remembered.

- 'Supporting the plotters' -

Erdogan had earlier also lashed out at a top US general who had expressed concerns about military relations after the putsch.

Quoted by US media, US Central Command chief General Joseph Votel said Thursday that the coup bid and subsequent round-up of dozens of generals could affect American cooperation with Turkey.

"You are taking the side of coup plotters instead of thanking this state for defeating the coup attempt," Erdogan said at a military centre in Golbasi outside Ankara, where air strikes left dozens dead during the coup.

Votel swiftly denied any link to the coup however.