The railways built during the colonial era in Morocco, Algeria, and Tunisia weren’t just about transportation – they shaped cities, economies, and landscapes in ways still visible today. Constructed by French colonial powers in the 19th and early 20th centuries, these rail networks prioritized military control, mineral extraction, and agricultural exports. Today, many modern rail routes in these countries trace their origins back to these colonial lines.
Key takeaways:
- Morocco: Routes like Tangier to Marrakech and Casablanca to Fes were originally military and economic corridors. The modern rail network spans 1,310 miles, with highlights like the high-speed Al Boraq train.
- Algeria: An east–west trunk line connected major cities like Algiers, Oran, and Constantine, focusing on cash crop exports.
- Tunisia: Railways centered on phosphate mining, linking inland mines to coastal ports like Sfax.
Colonial railways not only connected regions but also influenced urban growth, with cities near rail hubs thriving economically. Today, travelers can experience this history through preserved stations, scenic routes like Morocco’s Taza Gorge, and modern rail innovations that blend the past with the present.
Historical Background of Colonial Railways in North Africa
Colonial Expansion and Railway Foundations
When France set its sights on North Africa in the mid-19th century, it quickly realized that controlling such vast territories required more than just military presence. Infrastructure became a cornerstone of its strategy, and railways were at the heart of this plan. These rail networks weren’t just about transportation – they were tools for domination, resource extraction, and economic integration with Europe. Today, travelers can explore these regions through bespoke Africa travel packages that trace this historical legacy.
The priorities behind railway construction were clear. Railways were designed to serve military, economic, and logistical purposes. As CEPR researchers explain:
"the line was built to exercise ‘effective control’ in the Scramble for Africa, or to dispatch troops for better control of the native population"
"the line was built into the interior to further European mining interests"
"the colonial power built the line to connect agriculturally rich areas"
With limited budgets, colonial governments demanded railways that could generate revenue quickly. This meant planners focused on routes that offered immediate economic returns. Engineers followed what they called the "least-cost path", favoring the shortest and flattest routes. Locomotives were also restricted to gradients under 10%, further dictating where tracks could be laid.
| Motivation | Primary Objective |
|---|---|
| Political | Military control, troop movement, and "effective occupation" of territory |
| Economic (Mining) | Transporting minerals (e.g., phosphates) from the interior to coastal ports |
| Economic (Agriculture) | Connecting fertile inland regions to export markets |
| Logistical | Reducing construction costs by following the "least-cost path" |
| Source: |
These priorities shaped not only the rail networks but also the broader development of the region. Companies tasked with building these railways played a critical role in defining the urban and economic landscapes.
Key Railway Companies and Infrastructure
Two major companies took the lead in building and operating these colonial rail systems. In Morocco, the Compagnie des Chemins de fer du Maroc spearheaded the development of the country’s rail network. They established two key corridors: a north–south line connecting Tangier to Marrakech and an east–west line running from Casablanca through Fes to Oujda, near the Algerian border. Notably, the east–west route passed through the Taza Corridor, a narrow and strategically important passage between the Rif and Middle Atlas mountains.
In Tunisia, the Compagnie des phosphates de Gafsa focused on a more specialized mission – transporting phosphate ore. Their railways connected inland mines to coastal export hubs, creating a network tailored to the needs of the phosphate industry.
These railways didn’t just move goods and troops; they also shaped cities. Many urban centers that grew around railway hubs during the colonial period remain economically stronger than other cities of similar size. This is largely due to the infrastructure investments – like schools and hospitals – that colonial powers concentrated along these rail corridors.
sbb-itb-6675d37
Country-by-Country Railway Histories

Colonial-Era Railways of North Africa: Morocco, Algeria & Tunisia Compared
Algeria: The East–West Trunk Lines
In Algeria, the colonial railway system was crafted to connect the fertile interior regions with the Mediterranean coast. French engineers constructed an east–west trunk line linking Algiers, Oran, and Constantine, primarily to facilitate the export of cash crops to France. These railways not only shaped the agricultural economy but also influenced urban development. Cities like Oran and Constantine flourished along these corridors, with their growth concentrated within a 19-mile radius of the tracks. Beyond that distance, the railways’ impact on development diminished significantly.
Tunisia: Phosphate Transport and Coastal Trade
Tunisia’s railway network was largely built to serve the phosphate mining industry. Rail lines were laid to transport phosphate ore from mines near Gafsa to the port city of Sfax, creating a radial system focused on export rather than widespread connectivity. This structure reinforced a hierarchy where export hubs like Sfax emerged as key urban centers, a pattern that persists today. While Tunisia’s railways were extraction-focused, Morocco’s system evolved into a more integrated national network with far-reaching influence.
Morocco: From Military Lines to National Corridors
Morocco’s railway system initially served as a tool for military control but eventually grew into the country’s primary transportation network. Two main corridors, established during the colonial era, continue to define the nation’s urban and travel patterns: a north–south route from Tangier to Marrakech and an east–west route from Casablanca through Fes to Oujda near the Algerian border.
Over time, Morocco expanded and modernized its railways, which now span over 2,110 kilometers and serve more than 40 million passengers annually as of 2026. A major milestone was the launch of Al Boraq, Africa’s first high-speed train, in November 2018. Using Alstom duplex trainsets, this train operates at speeds of up to 320 km/h, transforming a former military route into a commercial corridor. With over 12 daily departures in each direction, it reduced the travel time between Tangier and Casablanca from nearly five hours to just 2 hours and 10 minutes. Additionally, the Fes–Oujda line, which winds through the Taza Gorge between the Rif and Middle Atlas mountains, remains a historically and visually striking segment of the original railway network.
Experiencing Colonial Rail Heritage Today
The legacy of colonial railways offers travelers a chance to step back in time and experience history firsthand.
Preserved Railway Stations and Architecture
Railway stations from the colonial era are more than just transit points – they’re architectural treasures. Take Rabat Ville in Morocco, for example. When the French extended the railway through Rabat, Marshal Lyautey insisted on routing the line through three tunnels beneath the city. This decision preserved the Moorish character of the old town.
"At Rabat [Marshal Lyautey] insisted on the railway engineers carrying the line under the town in three tunnels, to preserve the Moorish aspect of the old city." – Railway Wonders of the World
This careful planning in the 1920s protected Rabat’s historic medina. Other notable stations include Casablanca Voyageurs, the hub of Morocco’s rail network, and the 1928 Marrakech station, which blends French engineering with Moroccan aesthetics. In Algeria, Gare d’Alger in Algiers dates back to 1862, serving as the terminus of the country’s first railway – a 30-mile line connecting the capital to the southwest. Meanwhile, Tunisia’s central station in Tunis, established in 1874, anchored the nation’s initial standard gauge lines.
Scenic Rail Routes Worth Riding
For those seeking breathtaking views, North Africa’s railways deliver. The Fes to Oujda line is a standout, cutting through the dramatic Taza Gorge. This five- to six-hour journey winds between the Rif and Middle Atlas mountains, passing terraced hillsides and Berber villages. Pro tip: Sit on the left side of the train when heading eastward for the best views of the gorge.
Looking for something shorter? The Tangier to Asilah route offers a 45-minute ride along the Atlantic coastline, showcasing whitewashed fishing villages. Southbound travelers should sit on the right side for sweeping ocean views. Another favorite is the Casablanca to Marrakech corridor, a two-hour-and-40-minute ride linking Morocco’s commercial hub to the southern imperial city, passing rolling countryside and the Atlas foothills.
In Tunisia, the meter-gauge tracks near the Seldja Gorge tell a different story. Originally built in 1897 by the Gafsa Phosphate and Railroad Company to transport phosphate ore, these tracks now traverse one of North Africa’s most striking desert gorges, offering a glimpse into over a century of industrial history.
| Route | Highlight | Approx. Duration |
|---|---|---|
| Fes to Oujda | Taza Gorge, Rif & Middle Atlas mountains | 5–6 hours |
| Casablanca to Fes | Saiss plain, olive groves, stop at Meknes | ~3.5 hours |
| Tangier to Asilah | Atlantic coastline views, fishing villages | ~45 minutes |
| Casablanca to Marrakech | Rolling countryside, Atlas foothills | ~2 hrs 40 min |
Source for scenic routes:
These routes combine natural beauty with a sense of history, making them a must for rail enthusiasts and history buffs alike.
Tailor-Made Itineraries with Jo Vacations

To fully embrace the charm of colonial rail heritage, consider a custom journey with Jo Vacations. Their itineraries blend modern convenience with historical exploration. For instance, you might enjoy the high-speed Al Boraq train from Tangier to Casablanca, followed by a leisurely ride through the Taza Gorge. Transfers, such as between Marrakech and Fes or to off-network destinations like Chefchaouen, are seamlessly handled.
Pair these rail adventures with boutique stays in Fes’s medina and private tours of colonial-era stations for a journey that feels both immersive and effortless. With 24/7 concierge support and meticulous logistics, Jo Vacations ensures every detail is covered, making your exploration of North Africa’s rail heritage as smooth as it is memorable.
Conclusion
Colonial railways in Morocco, Algeria, and Tunisia weren’t just about moving goods – they redefined cities and their futures. Economic historians Remi Jedwab, Edward Kerby, and Alexander Moradi highlighted this lasting impact:
"Railroad cities, i.e. cities that emerged with the construction of the railroads, are still wealthier today than non-railroad cities of similar sizes."
What began as military routes now serve as vital links for modern commuters, weaving history into daily life. In Morocco, railways built over a century ago now carry millions of passengers each year between bustling hubs like Casablanca, Fes, and Marrakech. This enduring legacy offers more than just infrastructure – it provides a gateway to explore Morocco’s rich heritage. Picture this: you board Al Boraq, Africa’s fastest train, speeding at 320 km/h, and moments later, you’re wandering through ancient medinas that whisper stories of the past. It’s a journey where history and modernity meet seamlessly.
Want to experience this incredible blend for yourself? Jo Vacations curates unforgettable North African adventures. From the nostalgic charm of historic railways to luxurious private transfers and boutique accommodations, every detail is thoughtfully planned to make your journey extraordinary.
FAQs
How did colonial railways reshape where North African cities grew?
Railways introduced during the colonial era transformed the urban landscape of North Africa. Designed primarily to benefit colonial powers, these rail systems linked resource-abundant regions to coastal ports, spurring economic activity and the rise of new urban centers along their routes. Meanwhile, areas that were harder to access were often left out, leading to uneven development. The legacy of these railways is still visible today, as many cities that grew around these networks continue to play a key role in the region’s economy and urban structure.
Why were many colonial rail lines built to ports instead of between major towns?
Railroads during the colonial era were typically constructed to connect directly to ports rather than linking major towns. This approach aligned with the primary goals of colonial powers: maintaining military control, facilitating the export of resources such as minerals and cash crops, and minimizing construction costs. To achieve these savings, rail lines often followed the most cost-effective paths, frequently avoiding inland regions that were deemed less economically important.
What are the best colonial-era rail routes for scenic train rides today?
The colonial-era rail routes offer some breathtaking scenic train rides. The Fes to Oujda line takes you through the dramatic Taza Gorge, where steep gorges and rugged mountains create a striking backdrop. On the Casablanca to Fes route, you’ll pass through stretches of tranquil pastoral farmland, offering a peaceful glimpse into the countryside. Meanwhile, the Tangier to Asilah coastal line treats travelers to stunning ocean views, which are particularly magical during sunset.



