Tucked into the folds of the Rif Mountains, a town of cascading blue alleyways has become one of the most photographed places in North Africa. Yet Chefchaouen’s color is not simply a marketing gimmick dreamed up for Instagram. It grew out of centuries of war, exile, and coexistence between Amazigh mountain communities, Andalusian refugees, and Moroccan Jews, layered over a fortress built to keep invaders out. To understand why this corner of Morocco turned blue, you have to start with why it existed at all.
A Fortress Born of War

Chefchaouen was founded in 1471 by Mulay Ali ibn Rashid, a distant descendant of the Islamic Prophet Muhammad, and the original settlement consisted of just a small fortress, now referred to as Chefchaouen’s Kasbah, erected to help defend the area from potential attacks by Portuguese invaders.[1] Portugal had begun invading northern Africa following the Reconquista, seeking to expand its power and gain control of Morocco’s valuable grain, sugar, cattle, fish, hide, and honey trade.[2] This was not a trading post or a religious retreat. It was a military calculation, placed high in difficult terrain precisely because that terrain made it hard to attack.
As the neighboring cities of Ceuta and Tangier fell to invading Portuguese armies, Chefchaouen became something of a last stand fortress in the Rif region, with Alfonso V of Portugal emerging as its biggest threat.[2] The city’s founder came from a lineage that mattered politically as much as spiritually. He was an Idrisid and descendant of the Sufi saint Abd as-Salam ibn Mashish al-Alami, and he was also the father of Sayyida al-Hurra, who later governed Tetouan.[3] The Kasbah he built still anchors the medina today, a stone reminder that Chefchaouen’s first purpose was resistance, not beauty.
A City Closed to Outsiders

What followed the founding was not expansion into the wider world but a deliberate turning inward. The city remained closed to non-Muslims for centuries.[4] The city was closed to foreigners until 1920, with only three Christians said to have entered in four hundred years.[5] That kind of isolation is almost unimaginable by modern standards, yet it shaped everything about how the town developed, culturally and architecturally.
The isolation preserved things that had vanished elsewhere. When the Spanish occupied the city in 1920, they found a population that had been largely isolated from European contact for four hundred years.[6] When Spanish troops arrived in Chefchaouen in the early twentieth century, they found a population still speaking old Spanish dialects.[7] In effect, the mountain fortress had become a time capsule, holding onto language and customs that the rest of the Iberian world had long since moved past.
Refuge for the Displaced of Spain

The most defining chapter in Chefchaouen’s human story arrived after 1492, when Spain expelled its Muslim and Jewish populations. In the years that followed, especially after the fall of Granada in 1492 and the expulsion of Muslims and Jews from Andalusia, Chefchaouen became a refuge for waves of displaced people.[8] Muslim Andalusians brought with them their architecture, crafts, and refined aesthetic traditions from Islamic Spain, while Sephardic Jews, also expelled from Spain, established a Jewish quarter inside the city that remained part of its social fabric for centuries.[8]
This blending of communities left permanent fingerprints on the town’s layout and craft traditions. The red-tiled roofs, the whitewashed walls, and the narrow lanes converging on a central plaza all reflect this Andalusian inheritance layered onto Amazigh foundations, a pattern of resettlement that also shaped nearby Tétouan.[4] This unusual human mixture of mountain Amazigh communities, Andalusian migrants, and Moroccan Jews forms the historical background without which the color of Chefchaouen’s walls cannot be fully understood.[8] Refuge, in other words, came first. The color came later, built on the foundation those refugees laid.
From the Mellah to the Whole Medina

For a long stretch of its history, the blue was not everywhere. It stayed confined to a single neighborhood. Many inhabitants say that the blue walls of Chefchaouen were only found in the Jewish part of the city, the Mellah, until quite recently, with older residents recalling that most of the medina’s buildings were white in their younger years.[12] Other parts of the medina were still white until around forty years ago, when the rest of the city followed suit, likely for aesthetic or tourism purposes.[13]
The photographic record backs up this gradual spread rather than a single dramatic transformation. The oldest photographs, from the 1930s, show some blue but not the saturated monochrome of today, and the blueing seems to have intensified over the twentieth century, possibly accelerating alongside tourism.[5] What began as one community’s spiritual practice slowly became a shared civic identity, painted onto walls that had nothing to do with the original Mellah.
Spanish Rule and the Fight for Sovereignty

Resistance did not end with the Portuguese in the fifteenth century. It resurfaced centuries later against a new colonial power. It wasn’t until Chefchaouen was taken by the Spanish in 1920 that the doors to the city opened to anyone and everyone, and the blue followed soon after.[13] The Spanish Protectorate period brought European visitors and administrators into a city that had spent four centuries deliberately keeping them out, a jarring shift for a population accustomed to isolation.
Spanish rule over the north lasted until Morocco regained full sovereignty. Morocco recovered Chefchaouen in 1956 following the end of the Protectorate.[4] That date matters as much as 1471 in the town’s story of resistance. The people who had built a fortress against Portugal, closed their gates to Christians for centuries, and absorbed waves of refugees eventually reclaimed their own governance, folding the blue medina back into an independent Moroccan state.
Beyond Chefchaouen: Morocco’s Other Blue Corners

While Chefchaouen dominates the conversation, it is not the only Moroccan town where blue shows up as a defining feature. The capital, Rabat, is not as well known for its blue color as Chefchaouen, but its medina includes houses painted blue and white in some parts.[14] Along the Atlantic coast, a different blue tradition has taken hold entirely on its own terms.
Asilah, located on the Atlantic coast, has also embraced the color blue as part of its identity, and in addition to its blue and white painted houses, the city is known for its annual art festival that attracts artists from around the world to decorate its walls with murals.[14] Tangier, too, features some areas with touches of blue in parts of its medina, though it is not as famous for blue architecture as Chefchaouen.[14] These towns show that blue in Morocco is not a single monolithic tradition but a loose family of related customs, each shaped by local history rather than a copied formula.
Chefchaouen in the Tourism Boom of the 2020s

Morocco’s broader tourism numbers help explain why Chefchaouen’s streets feel busier than they used to. Morocco welcomed 17.4 million visitors in 2024, surpassing its target for 2026, with Marrakech and Chefchaouen experiencing substantial growth in tourism.[15] The Blue City, once a remote mountain outpost, now sits firmly on the international travel circuit, drawing crowds who come specifically to walk its indigo-washed alleys.
That popularity has practical downstream effects on how people reach the town. There is no train directly to Chefchaouen, so travelers rely on CTM bus, Supratours bus, or grand taxi from Fez or Tangier, with CTM fares in 2025 and 2026 running between 110 and 140 Moroccan dirhams and a journey time of four to four and a half hours.[16] Despite the crowds, visitors willing to move beyond the most photographed spots can still find quieter streets in the upper medina that remain genuinely lovely and nearly always empty.[16] The rush for the perfect photograph has not entirely erased the calm that first drew travelers there.
Why the Color Endures

Whatever combination of faith, climate, and folklore first put paint on those walls, the reason it continues today is more straightforward. Although attracting tourists was certainly not the original reason for the blue painting of Chefchaouen, it is a major reason the practice continues, transforming a former stop on the old trade route between Fez and Tangier into a global tourist destination.[12] There is also a very simple modern reason: people kept painting the town blue because visitors loved it, and over time Chefchaouen became known as the Blue City as tourism grew.[11]
The layered history behind that color gives it a weight that pure aesthetics never could. A fortress raised against Portuguese soldiers, a haven for Andalusian and Jewish refugees fleeing persecution, a closed city that stayed hidden from Europe for four centuries, and eventually a symbol reclaimed through independence. Chefchaouen’s blue walls carry all of that inside them, whether or not any single visitor walking through the medina today stops to think about it. The paint fades in the rain and gets reapplied every year, but the story underneath it has stayed remarkably intact.






