As for Morocco, the historical development of the Public Prosecution passed through three stages: the pre-protection phase, the protection phase and the post-independence stage.
And Moroccan legislation did not define the system of the public prosecution as a self-standing institution except when it came into contact with Europe by imposing protection on Morocco, as this system is among the legal heritage that France carried as a guardian of Morocco starting with the Treaty of Fez concluded on March 30, 1912. This is because the Islamic judiciary remained unaware of this institution until it first entered Morocco under the Dahir of August 12, 1913 related to the judicial organization of the French protection in Morocco. However, at the time, it did not go beyond the French modern courts due to the dualism of the criminal legislation, but the protection authorities were alerted to the importance of monitoring the stock justice practiced by the pashas and the pimps, by the civil observer and the government delegate, these two bodies were playing a role that sometimes approached the role of the public prosecutor whose functions were expanded Later, with later texts, they were used in the service of colonial policy.
With Morocco obtaining its independence, he initiated the Moroccan Criminal Procedure Law on February 10, 1959, which came literally - with some minor modifications - to the requirements of the French Criminal Procedure Law of 1958, thus copying the functions of the Public Prosecution as it is in French law, which was considered a gain. No matter what in the Moroccan legal field, he knew after that a number of amendments, the last of which was Law No. 22.01 related to the criminal procedure, as it was amended and completed according to Law No. 23.05 and Law No. 24.05/