The plaque on Béziers’s municipal theatre harks back to one of many occasions in the city’s long history when it opened its arms to foreigners. “Belgian refugees express their profound gratitude to the Biterroise [Béziers] population for the welcome they received between 1939-1941,” it reads.

Long before Belgium’s Jews sought a brief respite from Nazi persecution, Béziers was a haven for the Spanish fleeing Saracen invaders from Arabia in the eighth century. Today, however, the town offers little hospitality to the dispossessed – people such as Malek and Khaldieh Al Elfi and their children, refugees from the war in Syria.

Four years after escaping from their home in Homs, western Syria, which was coming under daily bombardment from forces loyal to President Bashar al-Assad, and embarking on the long journey to Europe, the Al Elfi family is again living in fear. Theirs is a case that has focused attention on what many say is an unduly harsh response to the refugee crisis. They have been “Dublined”.

In a move as arbitrary as it is soullessly administrative, local Béziers officials have decided the family must leave France – where they now have a home and friends, and know the language – and return to Spain, where they first entered the EU, but where they know no one and have nowhere to go.

This is the letter of the law: under the Dublin regulation, dating back to the 1990s, refugees must seek asylum in the first member state they set foot in. It is a law that has been judged outdated and inadequate to deal with the current influx of refugees to Europe and is in the process of being scrapped.

Angela Merkel dropped the rule last autumn and announced all Syrians were eligible to claim asylum in Germany. Sweden followed suit. France could do the same, and has done in the past, but is refusing to do so in the Al Elfis’ case.

Last week Malek, 41, Khaldieh, 32, and their children, Hisham, 15, Fata, 12, and Houmam, eight, were told by the local prefecture that they had 48 hours to leave France. They were warned that if they stayed they would be jailed.

Béziers, it should be noted, is controlled by the far-right Front National party, which supports mayor Robert Ménard. He has told Syrian refugees they are not welcome in his city.

The family is now in hiding. In a borrowed house, Khaldieh jumps at a knock on the door, fearing it is the police. She is anxious, depressed, losing her hair and suffering blinding migraines. Malek has not slept since the expulsion order.

“Every day I told the children things would be good once we got to France. We have friends in France, my wife speaks French, I told them they could go to school,” Malek says. “They would ask, ‘when can we go to school, papa?’ and I would say, ‘tomorrow; when we are in France everything will be fine’.”

The Elfis’ story is a familiar tale of the misery and exploitation suffered by the estimated one million Syrians who have fled the war in their homeland for safety in Europe. Having made the long, dangerous and costly trek to France – during which Khaldieh, then five months pregnant, had a miscarriage – the expulsion has come as a cruel blow.

The couple had sought asylum as soon as they arrived in France six weeks ago and were hopeful. Syrian families in an illegal squat in Béziers, who had also crossed from Spain, were approved to seek asylum. But, anxious not to break the law, the Al Elfi family refused space in the squat and found a house through a local humanitarian organisation.

They were being law-abiding and there was, they assumed, no reason why they should be penalised. When a letter arrived summoning them to the police headquarters last week they were ready to celebrate. Instead they were told their passports were confiscated and they were to be expelled.

Facebook Twitter Pinterest Malik Al Elfi in Homs Photograph: Kim Willsher/The Observer

It is not as if Béziers, or indeed France, is inundated with refugees. Under an agreement brokered by the EU last year, France agreed to accept the relocation of 30,700 refugees who had arrived by sea in Italy and Greece. So far only 300-500 have been relocated and the interior minister, Bernard Cazeneuve, admitted the country had to do better. Béziers has taken about a dozen Syrian families.

Those arriving by land, like the Al Elfi family, face an even more uncertain future – victims of often capricious decisions over whether they can stay or go.

The Montpellier prefecture told the Observer that several Syrian families who had come to France from Spain were “exceptionally” allowed to claim asylum last autumn, but this had been stopped to prevent the creation of a “refugee route” into the area. It said 27 adults and 13 children from Syria had demanded asylum in Montpellier. Two of the families are facing expulsion under the Dublin Regulation. The Hérault department, in which Montpellier is situated, has a population of almost 1.1 million.

Sitting in their hiding place, Khaldieh and Malek smile. Their children smile. They wish to be polite, hospitable, and avoid complaining, but their eyes betray a dark and profound despair.

Life was good for Khaldieh and Malek in pre-war Homs. Bashar al-Assad was slowly loosening his father’s dictatorial grip. Malek and his best friend Hassan, who had grown up together, had well-paid jobs working on construction of oil pipelines. They were inseparable and their wives and children were friends. In 2011, after Syrian rebels based in Homs called for the overthrow of the president, government forces hit back, pounding the city day and night with shells, mortars and sniper fire.

By 2012, Malek had bought a new house and car and was working on a lucrative two months on, one month off, contract in the Algerian desert when Khaldieh sent a message saying: “Get us out.”

“There were so many bombs being dropped on us, I felt sure we would all die. I thought we had lived our last hours on Earth,” Khaldieh says. The families took what valuables they could carry and fled Homs for Algeria. But when Malek and Hassan’s contracts ended, the work dried up. They had hoped to return to Homs, but after two years of war there was little of it left. “I slept exactly six nights in my new house and I left the new Peugeot 507 car with just 12km on the clock. It’s all buried under rubble now, I’m sure,” Malek adds.

They paid smugglers to get them into Morocco and from there crossed into Spain, paying local people to take their children over one by one. From Spain, they travelled to south-west France, where Hassan’s brother-in-law has lived for 12 years.

“We have given everything we have and paid about $6,000 [about £4,200] to get here. What for? To be told we have to go back to Spain? This is not a choice,” Malek says. “There’s nothing for us in Spain and Spain doesn’t want us. We’re wasting precious time when our children should be at school. They have lost their innocence and are losing their future with every month that passes.”Jean-Marie Larose, of the Solidarité Réfugiés organisation, is baffled by the expulsion order. “There are no hordes of Syrian refugees here and I don’t know why the prefecture has decided to treat this family so harshly,” Larose says. “They could use some discretion but they’re not – maybe because they want to look as if they are clamping down.”

Even after being allowed to apply for asylum, applicants must wait up to 19 months for approval, during which they cannot work or get benefits. The average rate for asylum being granted in France was just 22% in 2014, compared with an average of 45% across Europe.

“We are talking about a handful of Syrian families. France is involved in the war in Syria, the least we could do is welcome these people who have had to leave their homes and country. It is part of the Geneva convention and the Human Rights declaration,” Larose says.

Hassan, who has been allowed to claim asylum, says he and Malek will try to get their oil company jobs back if they can settle in France. “All we want in France is a normal life for our children,” Malek says. “And if one day the war stops in Syria we will go back. That’s if we have something to go back to.”

• Change.org petition opposing the expulsion of the Al Elfi family from France to Spain.