ANKARA (Reuters) - In the hours after Donald Trump secured the U.S. presidency, supporters of Turkish President Tayyip Erdogan triumphantly took to social media, hailing the election of a man who had threatened to ban Muslims from entering the United States.

Turkey's President Tayyip Erdogan attends a Republic Day ceremony at Anitkabir, the mausoleum of modern Turkey's founder Ataturk, to mark the republic's anniversary as he is flanked by Prime Minister Binali Yildirim (R) in Ankara, Turkey, October 29, 2016. REUTERS/Umit Bektas

At first glance, Trump seemed an unlikely hero for millions of Turks who support the Islamist-rooted AK Party founded by Erdogan in the predominantly Muslim nation. But in his victory, many saw a blow to a Washington establishment they say has failed Turkey as an ally and worked against its interests.

Anti-American sentiment in Turkey - a NATO ally key to the U.S.-led fight against Islamic State in neighboring Syria and Iraq - has risen sharply since a failed military coup in July.

Erdogan and the government blame the abortive coup on Fethullah Gulen, an Islamic cleric who has lived in self-imposed exile in Pennsylvania since 1999. Government supporters have been incensed by what they see as U.S. reluctance to extradite Gulen, who denies involvement in the plot, as well as Western criticism of a crackdown on his suspected followers.

“We can’t hide the disappointments we’ve felt during the Obama term,” said one senior member of the AK Party, speaking on condition of anonymity because Erdogan, who sets the tone of Turkish policy, has himself made little comment so far, beyond congratulating Trump.

“Trump’s pre-election comments on Muslims disappointed us, but these will be relegated to the context of campaigning. Real politics is different ... I think there will be much better dialogue between our president and Trump than with the previous administration,” the official said.

But Erdogan, like other leaders in the region, will be kept guessing by a Republican U.S. president-elect who has yet to make his policies in the Middle East clear.

Many Turks have also been angered by U.S. support for a Kurdish militia fighting Islamic State in Syria, seeing them as an extension of Kurdistan Workers Party (PKK) militants who have waged a bloody three-decade insurgency in Turkey.

Trump’s policy on this is unclear. He has indicated, though, that his priority in the multi-sided Syrian conflict will be fighting Islamic State - not forcing President Bashar al-Assad to leave power as Ankara has long desired.

This could not only put him at odds with Erdogan, but help shift the course of the Syrian civil war in favor of Assad and his allies. [nL8N1DB69G]

‘CONTROLLING HAND’

In Ankara’s corridors of power, few had expected Trump to win. But in his victory, senior officials sense an opportunity to reset an alliance that has been strained under Barack Obama, with whom Erdogan has had increasingly testy relations.

Trump, a real estate billionaire, and Erdogan, the son of a poor sea captain, are from different worlds but their leadership styles bear striking similarities - both are populists who command a devoted following but are deeply polarizing, and are not afraid to speak their mind.

There is a “high chance” of good chemistry between the two leaders, said a second senior Turkish official, even if they are unlikely to always see eye to eye.

“They’ll sit down without any pretence. Berlusconi was a bit like that,” the official said, referring to the former Italian prime minister, who enjoyed close relations with Erdogan.

Following Trump’s victory, Hilal Kaplan - a prominent journalist with the pro-government Sabah newspaper, which is run by the brother of Erdogan’s son-in-law - tweeted: “We’re happy to see the U.S. establishment cracking.”

“Turkey is one of those countries that rejects America’s controlling hand across the globe,” she later told Reuters. “Trump’s election is a blow to this international status quo.”

But deep divisions are likely to persist.

There may not be any swift progress on Gulen to remove a significant obstacle to smooth Turkish-U.S. ties

Turkish Prime Minister Binali Yildirim has already urged Trump to extradite the cleric, but that will ultimately be an issue for the U.S. judiciary, not the president, and a legal deliberation process that could take years.

Disagreements over Syria could also test relations.

Trump has questioned the wisdom of backing rebels fighting Assad and has suggested cooperating with Russia - the Syrian leader’s most powerful military ally - against Islamic State.

And while Hillary Clinton, the Democratic U.S. presidential candidate, stoked Turkish anger during the campaign by suggesting she would arm Kurdish militias fighting the jihadists, Trump has not explicitly ruled out such a move.

‘HONEYMOON’

“We’ll witness a period of honeymoon, post the end of the Obama period, where the relationship had become quite acrimonious,” Sinan Ulgen, a former Turkish diplomat and analyst at Carnegie Europe, said of Turkish-U.S. ties.

“Going forward, however, we are likely to see points of divergence,” he added. “Trump policies would certainly empower both the regime in Syria, the regime-friendly forces, and also Russia. That is against what Turkey has tried to do since 2011 in terms of regime change and backing the opposition.”

Trump’s backing of Israel will also worry Ankara, a major supporter of the Palestinians and a donor to the Hamas-run Gaza Strip. [nL8N1DA89T]

During campaigning, Trump won support in Israel with a promise that Washington would recognize Jerusalem as Israel’s capital. Palestinians want East Jerusalem, captured by Israel in a 1967 war, as capital of the state they aim to establish alongside Israel in the West Bank and Gaza Strip.

Trump’s threat to abandon NATO allies in Europe if they do not spend enough on defense, and his arguments against international trade agreements of the kind that could benefit Turkey, are also cause for concern in Ankara.

But as the world waits to see how Trump will shape his foreign policy, Ankara officialdom is remaining cautiously optimistic.

“Generally, Turkish governments are more at ease with Republican administrations in the United States than they are with Democrats,” said Halil Karaveli, managing editor of The Turkey Analyst, a policy journal.

“A new administration is a whole new ball game,” he added. “The Trump presidency represents, from the Turkish perspective, a chance for a restart.”