Within the mighty walls of Fez el-Jdid lies a gate with an odd name and even odder architecture.
Rabat – Bab El Makina is just a striking stone structure to most passersby. But beneath the weathered arch lies a story that’s been largely overlooked: a bold chapter in Morocco’s military modernization under Sultan Hassan I, and a powerful reminder that the North African country once dared to stand shoulder to shoulder with Europe’s great powers.
To understand Bab El Makina, you have to look beyond the façade. Built in 1886, this Italian-designed structure was no mere gate, it was the entry point to a military factory and academy.
The word “Makina,” borrowed from the Italian “macchina,” wasn’t a poetic flourish; it marked the site of Morocco’s first major attempt at industrializing its defense system.
Sultan Hassan I ordered its construction with a clear purpose: to drag a declining military machine into the modern era, one rifle at a time.
By the late 19th century, Morocco’s military had lost its former glory. The victorious days of the Almoravids, Almohads, and Merinids were ancient history.
Even the triumph of the 1578 Battle of the Three Kings, where Morocco stood tall against the Portuguese, had become a distant memory.
More recent history was less kind: the humiliating defeat against France in the Battle of Isly (1844) and another blow from Spain during the Tetouan War (1859–60). These weren’t just military losses, they were existential alarms.
Hassan I inherited a Morocco still smarting from these defeats. His predecessors had tried to modernize but were often undermined by foreign meddling, religious conservatives, and sheer logistical nightmares.
His father and grandfather had opened the door to European military instructors, imported outdated rifles, and tried (with mixed results) to assemble a standing army.
The Moroccan navy had already been dismantled in 1817. The country’s technological edge was slipping, and fast.
Determined not to follow in the footsteps of Egypt or Tunisia, both of which had succumbed to European financial control, Hassan I moved decisively.
He invited Italian engineers and officers to Morocco, and in 1885, struck a deal to create an arms factory in Fez. The location? A large tract of land west of the royal palace, close to the flowing waters of Oued Fes, which would power the machinery.
Under the supervision of Colonel Giorgio Broccoli and three Italian engineers, construction began. The result was a sprawling military complex equipped with metal forges, carpentry workshops, and imported tools, some from Venice itself.
Production began around 1889, but the factory wasn’t fully operational until 1891.
The facility could produce up to five rifles a day, modest by European standards, but revolutionary for a country like Morocco.
But not everyone was cheering.
This project faced internal sabotage from elites who profited off arms imports. Traders, smugglers, and brokers who had long held Morocco hostage to foreign supply chains didn’t want to see a self-sufficient army.
They rallied conservative clerics to denounce the factory as a dangerous innovation, even heretical.
Students returning from Europe with new ideas about science and military reform were painted as threats to tradition.
Despite the resistance, Hassan I pushed forward. He sent military students to Belgium, France, Italy, Germany, and even Spain to study modern tactics.
He brought in foreign officers to train Moroccan troops, dressed them in European-style uniforms, and experimented with standardized drills.
The goal wasn’t just to dress like a modern army, but to act and fight like one.
What set Hassan I apart was not just ambition, but foresight. He knew Morocco couldn’t remain a sovereign state if it didn’t adapt.
At the 1880 Madrid Conference, he managed to win international recognition for Morocco’s independence, a diplomatic victory that rested heavily on the credibility of his modernization program.
Still, the dream was short-lived. By 1912, when the French Protectorate was imposed, the factory was shut down, and the Moroccan army dissolved.
The building was repurposed for rug production. Today, almost nothing remains of the original military infrastructure, except for Bab El Makina itself.
It stands there quietly, often overlooked by tourists snapping photos or attending music festivals in the nearby square.
But for those who know its past, Bab El Makina is more than a gate. It’s a monument to a moment when Morocco tried boldly, imperfectly, and under immense pressure to chart its own future.
A century and a half later, it still whispers the story of a nation that once looked East and West and chose to build.
Read also: Spanish Star Miguel Poveda on Lorca, Morocco, and the Soulful Legacy of Flamenco