This study is based on a manuscript that chronicles the first regulatory law on the management of Moroccan ports before colonialism. Its main objective is to highlight two issues. Firstly, it seeks is to reveal developments in Morocco starting in the mid - nineteenth century at the levels of legislation and administration. Secondly, it hopes to highlight the relationship with openness to Europe, with all the problems this poses. It concludes that legislative modernization took place under the influence of contact with foreigners and in reaction to the capitalist wave that swept over Morocco. It also shows the multiplicity of imbalances that have plagued commercial traffic in Moroccan ports and prevented its economic performance at the legislative, human, technical, technical and regulatory levels.