By Robin Emmott

BRUSSELS (Reuters) - Turkey's long quest to join the European Union is likely to end in failure unless Ankara reverses its post-coup clamp-down on civil rights, press freedoms and the judiciary, the bloc's top official in charge of ties with Turkey said.

While Ankara is a crucial ally in Brussels' efforts to stop migrants reaching Europe, the European Commission, which handles the bloc's expansion, fears Turkey is becoming increasingly authoritarian and is concerned about the viability of its EU bid.

"It is certainly not heading in the European direction," said European Commissioner Johannes Hahn, who voiced incomprehension at the scale of President Tayyip Erdogan's purge of judges, teachers and the military following a July coup attempt in Turkey.

As the Commission published on Wednesday its most critical annual report yet of Turkey's progress in joining the bloc, Hahn said the democratic values central for any country to join the European Union were not up for negotiation.

"Turkey is an EU candidate and that means they have to accept that we apply higher standards... If they don't want to accept it, they have to face the consequences," Hahn told Reuters in an interview.

"One cannot negotiate democracy, the independence of the judiciary, the freedom of the press," Hahn said.

The accession of Turkey, a member of the NATO Western military alliance, has been a difficult issue since talks were formally launched in 2005, 18 years after it first applied to join.

Political obstacles, notably over Cyprus and long-standing resistance in Germany and France to the membership of a large Muslim country, have stalled the process despite several attempts to relaunch it, most notably in March when the EU sought Ankara's help to stop hundreds of thousands of migrants reaching Greece.

But the purge of more than 100,000 judges, police, teachers and soldiers since the failed coup on July 15 appears to go against EU accession rules, which center on the ability of a country to guarantee fair trials and human rights.

Turkish officials say the scale of the crackdown, which has broad popular support at home, is justified by the gravity of events in July, when rogue soldiers commandeered tanks, fighter jets and helicopters, bombing parliament and government buildings in their attempt to seize power.

More than 240 people, many of them civilians, were killed.

"TOUGH DISCUSSION" AHEAD

Hahn has publicly condemned the coup attempt and told Reuters that Turkey was justified in responding to it, but he said he had concerns about it going too far.

"If you take the magnitude of people being sacked, laid-off, arrested, it's hard to understand that all of them really in one or the other way were related to the coup," he said.

He urged Turkey to let the Council of Europe, a broader 47-nation body that promotes democracy and human rights on the continent, monitor the arrests and trials of those suspected of involvement in the coup attempt.

But he said it was up to EU governments, not the European Commission, to decide how accession negotiations could continue.

EU foreign ministers will discuss Turkey on Monday and again in December, with some countries, including Greece and Austria calling for an end to membership talks with Turkey.

"Some member states say we should not only suspend but abandon the accession negotiations. Others are speaking about sanctions (on Turkey)," Hahn said, referring to comments by Luxembourg's Foreign Minister Jean Asselborn this week that the purge was reminiscent of Nazi Germany.

Germany opposes sanctions on Turkey and has stressed Ankara is a key ally in fighting terrorism in the Middle East.

"It is time to have a very tough but fair discussion with our Turkish partners about the way forward," Hahn said.

(Editing by Hugh Lawson)