CEUTA, Spain—On the surface, this Spanish enclave on the North African end of the Strait of Gibraltar has integrated Muslims and Christians within a liberal democracy. The fact that Jewish and Hindu communities are part of the peaceful mix makes this place all the more intriguing.

Ceuta’s population mosaic reflects its history. It played a strategic role under Carthage and Rome, was the springboard of the Muslim conquest of Spain and was governed by the Saracens of Andalusia for centuries. The Portuguese took possession for a while, but it has been in Spanish hands since the end of the 16th century. Morocco has claimed it since the 1950s.

Things seem so smooth that one is tempted to evoke the great moments of religious and cultural coexistence in medieval Cordoba and Toledo. Muslims comprise 40 of the population and mostly see themselves as Spanish. They send their children to schools run by Christians, and they vote and compete in elections to the local Assembly, where the mainland Spanish parties control the majority. There are sporadic signs of fundamentalism, but no violence. The largest Muslim neighborhood is called Prince Philip, after the heir to the Spanish crown. Many residents are descendents of Muslims who fought against Morocco under Francisco Franco’s Spanish Legion and were later rewarded with Spanish citizenship. Most of the people I talked with in this city, in which the veil and the chilaba, a Moroccan tunic, are a potent presence, expressed few religious complaints.

That includes Sephardic Jews, who have been a part of Ceuta since the days of Saracen rule, and Hindus, who came in the late 20th century for commercial reasons. The church, the mosque, the synagogue and the temple are civil neighbors.

The immigration issue, a sensitive one in a border-fence city that many Africans see as a gateway to Europe, feels less of a time bomb today than it did a few years ago. Thousands of Moroccans work in Ceuta during the day and cross back in the evening. Illegal immigrants from other countries are detained for a few weeks in a center on Mount Hacho, but many are then quietly allowed to travel to the mainland.

One senses, however, that under the surface, things are potentially more troublesome. One big reason is that membership in the European Union, which Spain joined in 1986, has created serious economic limitations. Ceuta was a free port until Europe imposed its statist laws. Taxes are only a bit lower than in mainland Spain, and the regulations are overbearing. As one container operator put it to me, “We are a port city, but we really live off the military barracks and the stuff we smuggle into Morocco.” In the absence of free trade across the border, many Ceutans deal in illegal drugs, which come in through Benzu, in the northern area of Ceuta, under the peaceful gaze of the “Dead Woman,” a gorgeous rock formation on the Moroccan side.

The limitations placed on this city that could be a North African version of Hong Kong are creating a resentment that, if left to simmer, could stoke cultural and religious resentments.

The risk is compounded by the political football that Ceuta is fast becoming in Madrid. The Socialist government, keen to avoid hurting Morocco’s feelings, is making unpopular concessions, including the decision not to press the European Union to give the enclave a status comparable to that of the Canary Islands. In response, part of the Spanish right is succumbing to the temptation to use Ceuta as a nationalist symbol.

None of this is lost on Ceutans. In my conversations, they tended to take sides angrily—mostly for the nationalist faction. If we take into account Morocco’s persistent claim on Ceuta and the economic frustration mentioned earlier, the politicization of the enclave could spill over into the cultural and religious domains.

I asked a small-businesswoman what Ceuta would be like in 30 years. “If we continue to be simply a place of containment for immigration and a military barracks, we will eventually succumb to Moroccan pressure. The Muslim population is growing, and eventually religious leaders are bound to vie for influence over ordinary Muslims. If we don’t have much to show for ourselves, they will act on fertile ground.”

She might be right. Ceutans are screaming for a chance to prosper and for as little politicking as possible. Madrid and Brussels should take notice.