CEUTA, Spain — Residents of Spain’s multi-ethnic city of Ceuta are used to being in the news every time the fragile alliance between Spain and Morocco shakes up.

For many “Ceutis,” as locals are known, that comes with being a speck of a European nation in North Africa. The city is culturally closely intertwined with Morocco, with Muslims making over 40 percent of its population, but also separated from it by high perimeter fences that set apart the two extremes of poverty and prosperity.

But when relations hit a two-decade low this week over Spain’s help to one of Morocco’s top enemies, “Ceutis” confronted the sudden arrival of thousands of African migrants with sympathy, concern and in some cases hostility.

In one neighborhood, Muslim women, moved by the plight of young Moroccan men, gathered in a traditional house to sort out and distribute donated clothes. They also cooked food and offered migrants sleeping in the streets a place to shower.

The women said the migrants could be their children — and that their plight brought memories of past times when the migrant flow was in the opposite direction.

“I remember my mother telling me they were migrating too, people didn’t have anything to eat and were going to Morocco,” said 75-year-old Aisha Ali Mohammed, who was among those sorting through garments. “Now they are migrating here.”

Dozens of migrants gathered for respite outside of Nawal Ben Chalout’s family home, where she had shifted around to give shelter to three young men.

“The boys are very confused, very scared, I talk to them and they ask for food,” Ben Chalout said, adding that her neighbors were also opening their doors to offer a place to sleep and eat. “Sometimes they don’t even want food. They have questions, they want information.”

But the solidarity has not been unanimous. Several migrants spoke of attacks by groups of locals at night as they slept in the streets or fields.

Fouad, an Algerian man who was in Morocco and crossed into Ceuta earlier this week, said armed men woke him up pointing a gun at him. They beat him and others with a stick, used pepper spray on him and took his phone and money.

One migrant was taken to hospital after the beating, said Fouad, who declined to give his last name for fear of reprisal and deportation.

The arrival of 8,000 migrants in just 48 hours in a city of 85,000 was more than the result of strained relations between allies. It was a reminder of the sheer inequality between the two sides. While per capita GDP in 2019 was $30,000 on the Spanish side, it drops to $3,200 across the border, according to the World Bank.

But the bustling businesses of Spain’s Ceuta and Fnideq, the closest Moroccan town, have taken a big hit during the pandemic. With the border closed, over 30,000 workers who used to commute across it daily have been jobless for much of the past year.

Even before the pandemic hit, nationalist voices in Rabat were reviving old claims on Ceuta and Melilla, Spain’s second coastal enclave in North Africa.

That has fueled anti-Moroccan sentiment in Ceuta, a feeling tapped into by Spain’s new far-right party Vox, which became the city’s most popular party in Spain’s 2019 vote.

Vox has referred to the influx of migrants as an “invasion,” but the term has been also used by some conservatives, including the autonomous city’s president, Juan Jesús Vivas.

His government said more than half of the city’s children skipped school on Tuesday because their parents feared instability in the streets and some shops closed, fearing looting from cashless migrants.

But Fouad and others directed their anger at the Moroccan government for using them as pawns in the diplomatic impasse with Spain.

The government in Rabat has denied that it loosened border control to allow the migrants to cross, blaming it on the weather and the post-Ramadan “exhaustion” of its border guards. It has also criticized Spain for providing COVID-19 treatment to Brahim Ghail, the head of the Polisario Front that is fighting to make Western Sahara independent of Morocco, which annexed it in the 1970s.

“This was not improvised, it was planned. Morocco benefits by sending us,” said an 18-year-old Moroccan who crossed into Ceuta and feared deportation if his identity was published. “We are Morocco’s experiment, we are like lab rats.”

The man told how he had lost his mother years ago in a stampede at the Ceuta border, where many women earned their living as porters before authorities closed the border.

Many from Morocco said they wanted to reach mainland Spain to find work and stability. Yaser, a 26-year-old from Tetouan, said those he knew brought skills and education with them.

“We have boys with lots of education, baccalaureates, lots of diplomas, but they don’t have work,” he said. “That is the basis of all the problems, work, rights, good life … that is all people want.”