Castillo de San Marcos: Medieval Castle & 1000-Year Mosque in El Puerto
Inside the Castillo de San Marcos, in a corner of the main prayer chamber, there is a niche in the wall pointing toward Mecca. It’s been there for over a thousand years. Most visitors walk past without noticing, distracted by the Gothic arches and the towers that command the plaza. But that niche—the mihrab, the holiest part of any mosque—tells a story almost unique in medieval Spain: a story of destruction refused.
In most reconquered Spanish cities, the first act was demolition. Mosques became churches by being unmade and remade. Here, something different happened. The mosque was absorbed. Integrated. Preserved.
You can walk through it still.
Before the Castle: Al-Qanatir
The building that today is called Castillo de San Marcos began as a mosque. In the tenth century, when the settlement was called Al-Qanatir (The Arches), a Muslim community built a prayer house here. It had three naves, a courtyard, a minaret from which the call to prayer would have sounded five times daily.
The prayer chamber was oriented southeast, toward Mecca. Everything—the columns, the spacing, the light entering from specific angles—was designed around that sacred orientation.
During the eleventh and twelfth centuries, under Almohad rule, the mosque was enlarged and reinforced. This is the period you see most directly if you look carefully at the walls: the horizontal lines, the sharp-edged decorative bands typical of Almohade architecture, the sense of solidity and geometric precision that marks the building as serious, designed to last.
For centuries, it lasted. Muslims prayed here. The call sounded from the minaret. The rhythm of Islamic life structured the city.
Then came the Reconquista—and with it, a choice.
The Reconquista and the King’s Decision
By the 1260s, the Christian kingdoms were consolidating power across Iberia. The pattern was mechanical and brutal: conquer, destroy the mosque, build a church on the rubble. Erasure dressed as reconstruction.
Alfonso X—known as El Sabio (The Wise)—chose differently.
When his forces took El Puerto in 1264, he ordered the mosque transformed into a fortified church. But he ordered it transformed around the original Islamic structure. The mihrab stayed. The qibla wall (the wall facing Mecca) remained. The muezzin’s call chamber was converted but not demolished. The architectural bones of the mosque stayed beneath the new Christian superstructure.
Alfonso X was called “The Wise” for reasons beyond military strategy. He was a patron of learning from all three Abrahamic religions. His famous Cantigas de Santa María—a collection of over four hundred musical poems in Old Spanish that stands as one of medieval Europe’s greatest literary achievements—specifically references El Puerto’s miracles and this very fortress. He documented what he was doing, which is the reason we know he intended it.
Between 1264 and 1272, he had Gothic vaulting added: intricate ribbed ceilings, pointed arches, and four towers—two hexagonal, two square, one octagonal crown called the Torre del Homenaje (Tower of Homage).
The result was something no other castle in Andalusia quite resembles: approximately four thousand square meters of a building that contains, visibly, both a mosque and a medieval fortress.
What You Can Still See
The prayer niche (mihrab) is visible in the main chamber if you know where to look. Ask the attendant; they’ll point it out. The orientation is still perfect—if you stood facing that niche and said prayers, you’d be addressing Mecca, exactly as Muslims did a thousand years ago.
The qibla wall (facing southeast) is clearly distinguishable from the later Christian additions. The change in stone texture, in construction technique, marks the boundary between the Islamic foundation and the medieval fortress that was built around it rather than on top of it.
The courtyards suggest Islamic domestic logic—open spaces for light and air, rooms arranged around them. The Gothic arches, when you look beyond their beauty, sit on Islamic walls that were never demolished.
The towers are Gothic additions, military improvements needed because by the 1270s, the fortress served a strategic purpose: controlling the strait and the coast against Muslim raids from North Africa and the kingdom of Granada.
The Templars (Maybe) and the Order of the Star
Local tradition in the Cadiz Bay region mentions Templars—the famed warrior monks who controlled fortresses across Iberia. Documentation for their presence in El Puerto specifically is thin, but the possibility exists that they had a role between the 1250s and 1270s, the period when their power in Andalusia was most significant.
What is documented is more interesting: in 1272, Alfonso X founded the Order of Santa María de España, also called the Order of the Star. It was the only Spanish military-religious order created specifically for naval warfare. Its knights wore black tunics and red cloaks with gold stars. The Castillo de San Marcos was one of four main seats (the others in Cartagena, La Coruña, and San Sebastián).
The Order didn’t survive a naval defeat in 1278, but while it lasted, El Puerto was positioned as a naval fortress of the first rank, meant to control not just the coast but the strategic strait between Spain and North Africa.
Architecture: Layers You Can Read
Standing inside the castle, if you look carefully, you’re reading history in stone.
The Islamic period (10th-12th centuries): Thick walls, austere lines, functional geometry. The emphasis was on prayer space and community gathering.
The transition period (1264): The moment when the prayer house became a fortress, when a decision was made to preserve rather than erase.
The medieval Gothic period (1264-1272): The soaring vaults, the precise ribbed arches, the light entering through new windows. The addition of towers and a military logic that didn’t exist before.
The centuries after: Repairs, modifications, abandonment during periods of peace, reinforcement during periods of threat.
Visiting the Castillo
Location: Plaza Alfonso X El Sabio, center of El Puerto’s old town.
Hours: Typically 10 AM–2 PM, 4 PM–7 PM. Check before visiting; hours vary seasonally.
Admission: €2-3.
Guide: The site attendants are usually knowledgeable; asking directly (“Where is the mihrab?”) yields better results than wandering.
Photography: Generally allowed; ask about restrictions in specific areas.
Duration: 30-45 minutes for a focused visit, 60+ minutes if you sit with the history.
Nearby: The old town is a few minutes’ walk. Mercado de Abastos (market), river walks, and restaurants cluster nearby.
Why It Matters
The Castillo de San Marcos matters because it represents a choice: preservation over erasure, integration over destruction. It’s not the only place where Islamic and Christian architecture coexist in Spain, but it’s rare to see them this integrally combined, with the Islamic elements remaining so visible, so essential to understanding the whole.
It also represents a specific moment in medieval Spanish history when the reconquered territories were ruled by kings like Alfonso X who saw cultural and religious synthesis as part of their project. His court included Muslim, Jewish, and Christian scholars working together. His artistic output—the Cantigas, the architectural patronage—reflects that worldview.
By the time of his successors, that openness was already contracting. Within two centuries, Spain was on a path toward religious uniformity and the expulsions that would define the early modern period. But in the Castillo de San Marcos, the earlier vision is still visible.
For history travelers, it’s a place that rewards close attention. Not a grand spectacle, but a building that contains a conversation between cultures across a thousand years.
Pro tip: Visit in the late afternoon (4-5 PM) when the light enters the windows at angles similar to how it would have been experienced in the original Islamic period. The shadows change how you see the space.