CEUTA, Spain — A knife attack by an Islamist fanatic at the border crossing between Spain and Morocco last week has highlighted concerns about terrorists infiltrating among the hordes of migrants who relentlessly press up against the flimsy barriers of Europe’s two land borders with Africa.

In a recurring pattern of Islamic State-inspired violence seen in Israel, Europe and the U.S., a Moroccan national shouting “Allahu akhbar” stabbed a Spanish police officer before being overpowered Tuesday along the entrance to Spain’s North African enclave of Melilla. Just 240 miles to the west, hundreds of migrants threatened to force their way into Ceuta, Spain’s other holding on Africa’s Mediterranean coast.

The pressures are increasing as Madrid and other European capitals struggle to deal with a surge in migrants fleeing wars and seeking economic opportunity. Over the past two years, the surge has divided the European Union, upended the domestic political landscape in numerous countries and sparked harsh criticism from human rights groups.

The Spanish Interior Ministry is projecting a threefold increase in the flow of immigrants from Africa this year, with more than 10,750 seeking to enter the country in the first half of 2017. The office of the U.N. High Commissioner for Refugees has predicted a drastic rise immigration to Spain, warning that it could soon face the same pressures that have plagued Italy, which has been swamped by 59,000 illegal immigrants since January.

Spanish Interior Minister Juan Ignacio Zoido said managing the migration crush was one of the government’s top priorities, one made even more urgent with the deaths of 49 people in the Alboran Sea in early July after their rubber boat sank.

But Mr. Zoido added that it was not the responsibility of the government in Madrid that immigrants had “decided to run away from their homelands” in “boats that hardly float,” and added that Spain’s capacity to welcome immigrants was limited.

This ancient city claimed by Spain since the late 17th century is still surrounded by its medieval ramparts is the remnant of what was once Spanish Morocco. Ceuta was besieged in 1920 by the Bedouin rebel chieftain Abdel Krim, whose native uprising routed an entire Spanish army.

Today, Ceuta and Melilla are again under siege as history appears on the verge of repeating itself.

A double-wire fence topped by concertina wire is all that stands between the two Spanish enclaves cities and relentless waves of sub-Saharan and North African migrants, seeking to escape from the desperate poverty, terrorist violence, criminal bureaucracy and chaos of their respective native countries in search of a better life.

Migrants can be seen loitering in the hills and valleys surrounding Ceuta, anticipating the chance to climb or break through the wire enclosure covering a 9-mile-perimeter fence.

Many sit atop the 33-foot-high fence for hours and even days at a time. Over the objections of human rights organizations and leftist members of parliament, the Spanish government installed additional rolls of concertina wire on top of the fences to discourage the “fence dwellers.”

Groups of migrants also pile into vans known as “kamikazes,” which crash through the border fences and road barriers. Once inside Spanish territory, the migrants hope, authorities will be forced to accept them as refugees. Three such kamikaze strikes have been reported this year.

The essential component of Spain’s wall consists of heat-sensitive thermal cameras installed every 50 to 100 yards along the fence, monitored by Spain’s gendarmerie, the Civil Guard.

Just hours before the knife-wielding extremist attacked the border crossing in Melilla on the morning of July 25, the Civil Guard detected about 500 migrants gathering near the fence in Ceuta and directed Morocco’s security force, known as the DST, to where the groups were forming.

Pulling up in tanks and riot gear, the DST dispersed the migrants with what critics said was the kind of brutality that the Moroccan government has employed against unauthorized political protests.

Working with Morocco

According to a report in the Spanish newspaper El Pais, Spain’s security services complain that they can’t fully trust the Moroccan police, lacking knowledge of the DST’s “mysterious inner workings.” There is also concern that Morocco is using its cooperation on the migration issue as leverage to win concessions in other areas.

Morocco’s King Mohammed depends on the EU for investment and is expected to continue cooperating on border issues. But protests are rising against his rule, which has faced widespread complaints of corruption. Islamic extremists carried out a string of bombings against the tourist industry in 2002, and the knife-wielding attacker in Melilla last week also was heard shouting of Alucemas — a town in Morocco’s traditionally restive Rif mountain region where police are battling anti-government protesters.

Ceuta, Melilla and the southern tip of Spain — which is within swimming distance from the Moroccan coast — “are starting to resemble the U.S.-Mexican border,” said a senior official of the Civil Guard who agreed to speak on the condition of anonymity.

He and other officials say that without Morocco’s cooperation, the fences around Ceuta and Melilla would collapse and the fleets of refugee boats heading for Spain would be “unstoppable.”

According to the official, the European Union has established an advanced line of defense along the interior of the Sahara, encompassing the countries of Mali, Mauritania, Niger and Algeria. Spain’s Civil Guard and Italian and French gendarmerie units have set up operations along the line to stem the migrant flow.

Once on Spanish soil, immigrants typically are granted free passage into mainland Europe through the EU’s Schengen Agreement.

They invariably surrender to immigration authorities, who place them in temporary internment camps known by the Spanish acronym CETI, which have been built in Ceuta, Melilla and Spain’s southern port city of Algeciras.

Ahmed, a Cameroonian walking from Ceuta’s CETI for afternoon prayers at the nearby mosque, revealed that he climbed over the fence with hundreds of migrants who broke through the border in February.

He showed his temporary pass issued by the Spanish government and said he is being processed for an EU pass of “free circulation” that he expected to get in the next three months.

Ali from the Ivory Coast — the refugees are deeply reluctant to give their full names for publication — had a similar story and said he plans to go to France.

Amin, who came from Algeria, said he tried to get in with a false passport provided by a Muslim cleric. Despite having committed what is clearly a crime under international law, Ali said he sees no chance that he will be deported or sent to prison.

Mr. Zoido, the interior minister, has called for “raising the consciousness” of nongovernmental organizations that process the entry of African immigrants, arguing that the organizations do not appreciate the security problems posed by illegal immigration.

With an estimated 45 percent of its population now Muslim, Ceuta, has some 200 mosques, many of which operate Islamic schools known as madrassas. Critics say many of the schools led to the radicalization of students, and police rounded up what they called a terrorist cell in April.

Spanish authorities say the group, headed by a married couple, was planning attacks in Ceuta and had links to an Egyptian national arrested in the Spanish city of Alicante for aiding Islamic State militants entering Europe and for disseminating extremist propaganda online.

Officials in the Spanish Interior Ministry said authorities are constantly breaking up terrorist plots and have arrested 180 Islamic militants suspected of planning violence since 2015. Fears are growing that a major attack like the 2004 triple bombing of Madrid commuter trains by a Moroccan terrorist could occur at any moment.

Sign up for Daily Newsletters Manage Newsletters

Copyright © 2020 The Washington Times, LLC. Click here for reprint permission.