First rails in Morocco

4 min readMar 1, 2021

The first appearances of rail transport in Morocco was led by the French and Spanish colonial powers.

One of the earliest lines dates back to the Hispano or Spanish-Moroccan War. In 1859, a short line was quickly built to help transport troops and military material during the war. The line was around 10 km linking the coast from Río Martín (today’s Martil) to the main battlefield in Tetouan.

The first railway lines built by Spain in Northern Morocco

After winning the war, the line was dismantled in 1862 as it was only temporarily built for military purpose.

Not until 1887 that a short line was built in Agdal garden inside the Royal palace in Meknes. It was built by Belgian diplomats, and a German locomotive was offered to Hassan 1st (the Sultan at that time). The exhibition aimed at impressing the Sultan and thus convince him to buy the new rail transport technology for his country. However, the attempt failed and no rail network has subsequently been built.

A photo of Hassan 1st in the garden of Meknes royal palace in 1887

Few years later, the French attempted to demonstrate the rail technology again in 1901 during the reign of Abdelaziz, an avid consumer of the latest technologies at that time. Just like with the Belgians, this attempt was also another failure. The reason was that two train wheels were stolen while transporting the rolling-stock before the demonstration took place. No more demonstrations were scheduled due to the political instability in the following years, i.e., Bouhmara insurgence.

A photo of Sultan Abdelaziz, a fan of gadgets and newest technology, with his bicycle in 1901

The construction of the first rail networks will be initiated just after the conference of Algeciras in April 1906. The signed treaty allowed for more involvement of foreign (French and Spanish) powers in Morocco.

Almuqri (a Moroccan diplomat) while signing the treaty at the 1906 Algeciras Conference

Soon after, a line was constructed at the port of Casablanca (Anfa), and 3 locomotives were already in operations in the beginning of 1907. The line was intended to transport construction material to build and expand the port at that time.

However, the first troubles happened in the end of July 1907. Violence erupted as the local population demonstrated because of the line extension work are passing near Sidi Belyout cemetery. A strong and violent military response from French (and Spanish) troops put an end to the demonstrations.

From the port of Casablanca, the line was extended to reach Berrechid by September 1908. This marks the inauguration of the first line with the purpose of linking mines with a port. It was first built as a narrow 50 cm gauge line but was later converted to 60 cm. Meanwhile Spain began building a line from the port of Melilla to Nador, and the exploitation of a 5 km section started by 1909.

The narrow gauge (60 cm) network that was built by France from 1908 in Morocco

This first mine rail line, between Berrechid and Casablanca, was around 40 km. Initially, animals were used for traction and a one-way journey took in average around 3 hours and 30 minutes. The line was, therefore, locally called babbour lbghal, meaning mule boat. However, once steam engine locomotives were used, the name became babbour lmashina, meaning machine boat.

A part from the use of the line for transporting natural resources from mines to the port of Casablanca, it also served to transport troops and military equipment on the other direction. These military transport using rail was intended to support the French operations against local tribes in mainland Morocco, the so-called Pacification.

Expansion of the French military operations (pacification) from Casablanca.

The first civilian passenger trips by train will not be allowed on this first line before the year 1920.




Transport, economics, history and linguistics (among others) feed my interest!