Over the past two days, angry groups of men in a half-dozen cities in Turkey have turned on the Syrian refugees living among them, damaging their shops and cars and assaulting them with fists and knives.
Across the border in parts of northern Syria where Turkey holds sway, Syrians have confronted the Turkish soldiers in their midst, pelting their vehicles with rocks, tearing down Turkish flags and condemning them in street protests.
The scattered violence, which has left at least seven people dead in Syria, according to a war monitor, has exposed growing cracks in the coexistence between Syrians and Turks on both sides of their shared border. After years of generally peaceful relations, recent political shifts and deepening economic distress have brought tensions to the surface.
Many Turks have come to resent the 3.1 million Syrian refugees in their country and accuse them, with or without evidence, of fueling economic troubles that include low wages and persistent inflation that exceeded 75 percent in May.
And many Syrians who oppose the government of President Bashar al-Assad have gone from viewing Turkey as their greatest protector to fearing that it will abandon them. Support for the idea of sending Syrian refugees home has spread across Turkey’s political spectrum.
Turkey’s president, Recep Tayyip Erdogan, who cut ties with Syria in 2011 and backed the rebels seeking to topple Mr. al-Assad, said last week he would not rule out meeting his former foe to try to restore ties.
Speaking by phone from Idlib, a province in northern Syria where protesters clashed with Turkish soldiers this week, a Syrian activist who gave his name as Abu Samer al-Halabi said the region was “like a balloon, about to pop.”
“This tension has deep reasons,” he said. “Above the table, the Turks are with us, but under the table, they are not.”
After the Syrian civil war began in 2011, Turkey threw its border open to refugees fleeing brutal assaults by the Syrian military on rebel communities. Turkey built camps to house them, hosted the political opposition to Mr. al-Assad and backed the rebels in northern Syria battling his forces.
In more recent years, as the war settled into a stalemate, Turkey moved its own forces into rebel-held areas of Syria along the border, posting soldiers along sensitive front lines to deter advances and forming tight bonds with rebel groups in a so-called safe zone that it hoped Syrian refugees in Turkey would return to.
But relatively few have done so, leaving millions of Syrians spread across Turkey. Generally, they have peacefully lived alongside their Turkish hosts, with many learning to speak Turkish and sending their children to the country’s schools. While some have started businesses, many earn low wages in manufacturing and agriculture jobs.
Many Turks opposed allowing so many Syrians into the country, but their views toward the refugees have further soured since a cost-of-living crisis that began in 2018 has left many Turks feeling poorer. Encouraged by right-wing politicians and journalists, many have turned their ire toward the refugees.
The unrest this week was set off by allegations on Sunday that a Syrian man had molested his 7-year-old cousin in a public bathroom in Kayseri, a city in central Turkey. The man was arrested, and the girl and her mother and siblings were put under state protection while the police investigated, the Turkish authorities said.
That night, angry men in Kayseri attacked Syrian cars, shops and homes, setting some on fire, according to footage posted on social media and broadcast by Turkish TV stations.
On Monday, similar attacks happened in a half-dozen other cities, including Hatay, Konya and Istanbul, with men marching with batons through neighborhoods where Syrians live and throwing stones at their buildings. In Gaziantep, a group of men surrounded a Syrian man and stabbed him in the leg, causing him to flee across a busy street, according to surveillance footage broadcast by Turkish news media.
Addressing a gathering of mayors from his governing Justice and Development Party on Monday, Mr. Erdogan condemned the violence and accused his political opponents of stoking it.
“We won’t get anywhere by fueling xenophobia and hatred against refugees in the society,” Mr. Erdogan said, adding that the attacks had been carried out by a “small group” inspired by “this poisonous discourse of the opposition.”
On Tuesday, the Turkish interior minister, Ali Yerlikaya, wrote on social media that the security forces had detained 474 people in connection with the violence.
As news of the attacks in Turkey spread in Syria, protesters and armed groups there targeted Turkish forces, accusing the Turks of racism toward Syrians. Also fueling the anger, activists in the area said, was fear that Turkey was exploring ways to restore ties with Mr. al-Assad, a scenario that could endanger Syrians living in areas currently outside the government’s control.
Unrest has broken out in towns across northern Syria, with rebels and protesters confronting Turkish troops. Demonstrators tried to storm the headquarters of the Turkish-backed administration in the town of Afrin on Monday, leading to clashes that killed six people, according to the Syrian Observatory for Human Rights, a war monitor based in Britain. A seventh was killed elsewhere.
Turkey has responded by removing some Turkish troops from their posts, reinforcing others and shutting border crossings between Turkey and Syria on Tuesday.
Serhat Erkmen, a Turkish security analyst who does research in northern Syria, said in an interview that armed groups there had been on edge over the possibility that Turkey and Syria would mend ties. Many of their members fled to the north from elsewhere in Syria and feared losing the Turkish protection they had come to count on.
“For them, the idea of Ankara and Damascus reconciling may mean back to status quo, but it is not possible for them to go back to the status quo before the war,” Mr. Erkmen said. “When they hear things like peace negotiations, they feel that they will lose their future.”
Turkey may be able to calm the situation now, but Mr. Erkmen said he expected that interactions between the Syrian and Turkish governments would continue to grow, eventually bringing Mr. Erdogan and Mr. al-Assad together.
“It is coming,” he said. “First, high-level contact, and then, leader-level contact.”
Hwaida Saad contributed reporting from Beirut, Lebanon.