By Robin Emmott and Alastair Macdonald
BRUSSELS (Reuters) - European leaders greeted the defeat of Turkey's coup on Saturday with relief as it averts chaos and keeps alive a deal that has helped to stem the migration crisis threatening the continent.
But while some hope a reminder of resistance to his personal grip on power may prompt President Tayyip Erdogan to heed European pleas for him to respect civil rights, many fear he is far more likely to step up his crackdown on opponents and so complicate European Union efforts to maintain the bargain.
The coming weeks, starting when EU foreign ministers meet in Brussels on Monday, will be crucial to the fate of a plan at the heart of the migrant deal: to have skeptical EU lawmakers approve after the summer an end to visa requirements for Turks.
"Erdogan will be judged on his response," one EU official involved in the plan said, citing arrests of judges as an early sign that justified "deep concern that this will lead to a new trampling on rights of freedom of expression and demonstration".
Senior members of the European Parliament, where anger at the prickly Turkish leader's treatment of elected opponents could stymie the EU deal to reward Turkey for stopping refugees, were pessimistic about the outlook for Turkish democracy.
"Erdogan will try to extend his position of power," foreign affairs committee chair Elmar Brok, an ally of the Turkey deal's architect German Chancellor Angela Merkel, told Die Welt daily.
French President Francois Hollande expects "repression".
If Erdogan responds to public demands to restore the death penalty to execute putschists, or if Turkey moves to jail ethnic Kurdish parliamentarians whom it stripped of immunity in May, EU lawmakers may turn against the migrant deal, EU officials said.
Turkish officials have warned that its collapse could see Ankara allow a resumption of traffic that last year saw a million people, many refugees from Syria and Iraq, cross to Greek islands and trek over open borders to Germany.
That shook Europeans' support for the EU and, some argue, fueled last month's devastating British vote to leave the bloc.
NUANCED SUPPORT - 'NOT ABOUT ERDOGAN'
Official statements from the EU stressed backing for a democracy that many acknowledge Erdogan has himself abused.
"The EU fully supports the democratically elected government," an early overnight statement read, taking care to add it also backed "the institutions of the country and the rule of law" - a nuanced distinction from Erdogan's personal power.
With the plot seemingly already undone, EU foreign policy chief Federica Mogherini followed up to urge "a swift return to Turkey's constitutional order with its checks and balances and ... fundamental freedoms". It seemed hardly a call to defeated soldiers dead or in jail, but rather to the victor.
"This is not about supporting Erdogan or not, it is about supporting the rule of law and democracy," a second senior EU official involved in relations with Ankara told Reuters.
EU officials have reminded Turkish counterparts that their past cooperation, in engaging Ankara in a decade of halting reforms to enhance its - distant - prospects of joining the bloc, has helped Erdogan and his Islamist-rooted party to curb the historic threat to civilian rule from Turkey's armed forces.
Now, closer ties with the economic bloc are at stake, the second official said, insisting Europe can use that "leverage", despite criticism from human rights groups that Merkel's deal with Erdogan to hold back migrants put Europe at his mercy.
"This is not a blank check for Erdogan," he said of backing against the coup. "He has to be extremely careful not to overshoot the reaction."
HOPE FOR CHANGE? - 'ERDOGAN IS NOT PUTIN'
Many EU diplomats argue that Turkey, faced with conflict across its borders in Iraq and Syria that has fueled internal strife with its Kurdish minority, and at odds with Russia and most Middle East powers, cannot afford to alienate Europeans.
And some dared to voice hope on Saturday that the coup bid might make Erdogan more willing to reach beyond his own voters:
"Erdogan is not Putin - he is not that strong. We have to keep him on the democratic path," a third EU official said.
Expressing a hope that Europeans might now warm to Erdogan again as a lesser of two evils, less unappealing than chaos, or army rule, a fourth EU official referred to the president's call to unarmed supporters to face down the army: "If you win by saying democracy is stronger than tanks," he said, "then the 'democratically elected government' should act for democracy."
A fifth EU official was pessimistic, however: "It would be nice if Erdogan saw this as a wake-up call" to respect civil rights, he said, but a crackdown seemed "almost inevitable".
Senior diplomats dismissed suggestions, however, that the EU had hesitated to condemn the plotters in the early hours in the hope of change. However irksome many find Erdogan, they said, statements against the putsch came as quickly as possible.
"Clearly Europe would have more reasons to worry if the coup had prevailed," one EU official said.
CARDS TO PLAY - 'TURKEY BENEFITS'
Some fear Erdogan can use his control of the migration route to Europe to ignore calls for restraint in penalizing opponents, but others argue that Europe has cards to play against him.
They even play down the importance of Turkish cooperation in the migrant crisis, citing data showing that closing down routes from Greece through the Balkans was at least as big a factor in deterring all but a few from crossing to Europe since March.
Referring to Ankara's hopes of aid for 2.7 million Syrians it is housing, and for visa liberalization eagerly anticipated by many Turks, a senior European government official said: "The deal is in Turkey's interests, so why should they change it?"
As big a hurdle could be the European Parliament, where some had threatened to block the visa bill if Turkey jails any of dozens of Kurdish lawmakers who were stripped of their immunity from prosecution by a pro-Erdogan majority two months ago.
German leftist Martina Michels said it was Europe's failure to stand up to the Turkish president that had destabilized Turkey. Now, she said: "An uncritical courting of Erdogan as a partner in the wrong solution to the refugee issue must end."
(Additional reporting by Paul Taylor in Brussels and Michael Nienaber and Andreas Rinke in Berlin; Writing by Alastair Macdonald; Editing by Mark Potter)