Within hours of Turkey’s opposition party winning the rerun of Istanbul’s mayoral election, a new hashtag began trending on Twitter. “Suriyeliler Defoluyor,” or “Syrians, get out,” makes depressing reading, with tweets repeating all-too-familiar anti-refugee half-truths, inventions and barely disguised racism.

That was on a Sunday. The following Saturday, fights broke out in western Istanbul, with groups of Turkish men ransacking Syrian-owned businesses. Videos of the clashes were shared on social media – ugly scenes of dozens of young men attacking shops while others shouted encouragement. Police used teargas and water cannon to break up the mobs.

The link between a shift in political mood toward Syrian refugees and violence is becoming increasingly clear. A weakening economy and rising unemployment have led to increased resentment toward the 3.6 million Syrians living in Turkey – the largest refugee population in the world. But political opportunism is also a big part of the story.

The opposition knows that the Syrian issue leaves President Recep Tayyip Erdogan and his AKP (Justice and Development Party) exposed. The refugees within Turkey and the country’s military actions abroad are closely and personally associated with the president himself. But in attempting to undermine him, the opposition is attacking some of the most vulnerable in the country.

No politician has openly advocated violence against Syrians. But, as elsewhere on the European continent, the language of politicians has become darker when it comes to refugees, with hints and allusions that some thuggish elements are only too eager to interpret in the worst way.

Istanbul’s new mayor, Ekrem Imamoglu, a fervent opponent of Erdogan, made “radical love” a central feature of his campaign, promising to be “mayor of all citizens, regardless of ethnicity.” But that hasn’t stopped him flirting with anti-Syrian sentiment. Only days after his victory, he was complaining that Turks “cannot read the shop signs” in some parts of the city. Days later, the office of the governor of Istanbul (a separate post from mayor) said businesses would be informed that signs written only in Arabic were not permitted.

Imamoglu also appeared to play down the violence, dismissing the culprits as “restless.” In an interview with the British Broadcasting Corporation, when the words “This is Turkey, this is Istanbul!” (taken from one of his speeches but worryingly similar to chants heard during the clashes) were read back to hm, he nodded in approval.

Syrians outnumbering Turks in some cities is now a popular anti-Syrian motif, one that the new mayor of Istanbul has repeated, even though it appears to be untrue. The Syrian population in border towns has swelled by 30%, which undoubtedly poses a significant challenge to the local authorities in those places, but as a blanket statement, the claim of Syrians outnumbering Turks is unsubstantiated.

Imamoglu is not alone. The leader of his Republican People’s Party (CHP), Kemal Kilicdaroglu, has repeatedly taken a harsh line on Syrians, saying the refugees should go home. Politicians in the nationalist Iyi Party, allies of the CHP at the last election, echo that line.

Anti-Syrian rhetoric is gaining popularity because it is a powerful tool with which to attack Erdogan. When Imamoglu says the process of settling refugees has been “badly managed,” he is not only attacking the previous – AKP – mayor of Istanbul, but Erdogan himself, because Turkey’s policy on Syrians is perceived to be of his making. At first that decision to offer refuge to Syrians, when few other countries were willing to do so, was popular.

Frustrations have festered, both against the presence of Syrians and the deployment of Turkish soldiers overseas. Many ask, not unreasonably, why their sons are being killed in a foreign war

But as the years and the war in Syria have dragged on, the frustrations have festered, both against the presence of Syrians and the deployment of Turkish soldiers overseas. Many ask, not unreasonably, why their sons are being killed in a foreign war.

Public sentiment at home is also affecting Erdogan’s military adventures overseas. They are two sides of the same coin: The anti-migrant sentiment within Turkey makes effective military action in Syria even more urgent as Erdogan seeks a way to make it possible for Syrians to go home.

His solution is to continue expanding the enclaves on the Syrian side of the border where Syrians live under the protection of Turkish troops. Perhaps 80,000 have already returned to Syria this year, many to those areas, which stretch for hundreds of kilometers, hugging the Syria-Turkey border to the town of Jarabulus on the banks of the Euphrates River.

After months of talks, Ankara and Washington finally reached an agreement on setting up a wider safe zone on the Syrian side of the border. The Turkish president’s announcement at the start of this week that he would carry out a military operation in the Syrian Kurdish areas east of the Euphrates appears to have pushed the US into agreeing.

Securing the border and setting up a safe zone are a matter of the gravest political importance for Erdogan and his party, and there was a good chance that, the United States’ public objections notwithstanding, Ankara would have gone ahead with the operation. With the agreement in place, that particular danger has been averted – but the detail of the agreement, in particular who will patrol it and what Damascus will do, are still unknown.

For better or worse, the fate of Syria’s refugees is tied to Erdogan. It was his decision to take them in, but his own political fortunes are now making their lives harder. Ankara’s mismanagement of the economy has made footing the refugee bill more difficult and exposed a weakness in Erdogan that his opponents are exploiting. The host has the problem but it is the guests who are suffering for it.

This article was provided to Asia Times by Syndication Bureau, which holds copyright.