Countries neighbouring the still rumbling Syrian war are rounding up hundreds of workers and sending many back to volatile parts of the country, raising fears of mass deportations that will imperil large numbers of refugees.

Syrians living in Istanbul and Beirut have been targeted by immigration authorities in recent weeks, with more than 1,000 detained in Turkey’s biggest city last weekend and given 30 days to leave.

Some refugees described a whirlwind deportation process of being transferred through three detention facilities. Their mobile phones confiscated, they were held incommunicado from families or lawyers and forced to sign papers saying they “voluntarily” agreed to return to war-ravaged Syria.

The scale and speed of the arrests mark a reversal of Turkey’s open-door policy towards Syrian refugees – a hallmark of the war’s early years during which up to 5 million people crossed the Turkish border.

In the Lebanese capital, refugees, many of them undocumented workers, have spoken of being summarily dismissed from their jobs since early July as part of a new government decree, the stated aim of which is to prioritise Lebanese labour over foreign workers. The new law comes amid heightened political rhetoric over the fate of Syrian migrants, with Lebanese allies of the Syrian leader insisting that the war is all but over and the country is safe.

While tensions between refugees and host governments have risen in recent years, the current moves pose the most pointed threat yet to more than 5 million Syrians living in Turkey and Lebanon – two countries that readily took in those fleeing the fighting as the war intensified from 2012.

As the fortunes of the anti-Assad opposition have shifted in favour of the Syrian leader and his backers, so too have the politics; Turkey, while remaining a nominal foe of Bashar al-Assad, now approaches the war through more narrow national interests, allying with armed opposition groups where it chooses but no longer pushing for regime change.

Lebanon’s prime minister, Saad Hariri, a backer of the armed opposition in the early years, has also changed tack and, sparked by politicians whose fortunes are tied to the Assad regime, the country’s political discourse has turned against Syrians. In Lebanon and Turkey, polling shows sentiment running heavily against Syrian refugees, with a widespread view that undocumented migrants are taking jobs that would otherwise go to locals.

The claim by politicians in Lebanon that conditions have stabilised in Syria has been widely contradicted by humanitarian groups, and by the existence of still-raging battlefields in Syria’s north-west, which have been routinely bombarded since the end of April. A Russian and Syrian-led air campaign in that time has killed more than 400 people, including 90 children, monitoring organisations say. In the latest attack, a marketplace in the town of Ariha was bombed on Saturday, killing 11 and wounding more than a dozen others.

Lebanon’s labour minister, Camille Abousleiman, said he was “simply applying the law”.

“It is my job to properly regulate the labour market,” he said. “To encourage Lebanese workers, as the economy isn’t doing so well, and regulate the foreign workers. If the law wasn’t implemented prior, it isn’t my burden to bear. I sympathise with Syrians dearly. I understand they don’t want to go back because it’s not safe for them.”

Clara Long, the acting deputy Washington director of Human Rights Watch, said: “The Syrian government and other groups continue to disregard international human rights and humanitarian law protections”. She added: “Many of the core reasons that Syrians fled – indiscriminate attacks, disappearances, torture and dire humanitarian conditions – still pose a daily risk to civilians.”

In Syrian government-held areas, refugees who have returned voluntarily or been forced across the border report widespread conscription and detentions. Many say their properties have been seized by regime officials as part of a highly controversial law that confiscates the homes of those suspected of being members or supporters of the armed opposition.

After he was arrested in Istanbul, one Syrian man from Idlib, Mahmoud Qaddah, said: “In the eight days I spent detained, I signed more than 15 papers. They never said what they were, and there was no translator. ‘Sign and you can go home,’ they said – I didn’t think that they meant to Syria.”

Gökçe Ceylandağ, a spokesperson for Turkey’s migration directorate, denied that Syrians were being forced back. “Syrians are not sent back except in cases of voluntary repatriation. These allegations do not reflect the truth.”

Alaa Mohammed, 25, spent eight days in police custody after being asked for papers in Istanbul. Then he was sent to Idlib province.

“I’m the only breadwinner of my family,” he said from Idlib. “I got scared and felt forced to just give my fingerprints and sign the papers they put in front of me. No one answered our questions. We had no idea what was our destiny would be.”

Liz Throssell, a spokesperson for the UN refugee agency UNHCR, said: “Politically, this is very sensitive. We are in constant dialogue with the government on a number of issues, particularly about people having to go back to their provinces … but are looking at a number of reported cases related to deportations and have not been able to confirm those.”

Bassel Hailam, the vice-president of the civil society group the Syrian Associations Platform, said his organisation was tracking 2,600 deportations from Turkey over the past two years.

Additional reporting by Nadia Alfaour