Introduction: When artificial intelligence walks into a Moroccan workplace dispute
In 2023, at a labour law practice in Casablanca, a familiar story started to change shape. A senior accountant working for an industrial SME in Aïn Sebaâ had spent more than a decade handling invoices, supplier reconciliations and monthly closing. Then the company deployed a new ERP system with automated accounting modules, dashboarding tools and predictive controls. A few months later, his position was declared redundant. The explanation was simple on paper: the business was reorganising after a technological upgrade. In human terms, it felt harsher. He was not replaced by another employee. He was replaced by software.
That kind of case is no longer futuristic. It is already here. Casablanca has become one of the places where the debate on the future of work, automation and artificial intelligence is beginning to move from conference rooms to HR departments, labour inspections and, increasingly, court files. According to recurring analyses discussed in Morocco around automation risk, a significant share of jobs contain tasks that can be partially or heavily automated. The exact percentage varies depending on methodology, but the concern is real across banking, call centres, industry, logistics, accounting and back-office services.
The legal problem is straightforward to state, but harder to solve: does Moroccan labour law protect employees whose jobs disappear because of automation or AI? The answer is neither a clean yes nor a clean no. Law No. 65-99 forming the Moroccan Labour Code, promulgated by Dahir n°1-03-194 of 14 Rajab 1424 (11 September 2003), does not mention artificial intelligence, algorithms, robotics or machine learning. Not once. Yet the Code does contain a concept broad enough to capture this reality: technological changes, especially in the rules on economic dismissal.
That is the doorway. It is not a perfect one. In twenty years of practice, many legal texts have aged badly. Few have aged as quickly as the provisions on economic dismissal when faced with digital transformation. Still, employees are not without remedies, and employers are not free to invoke innovation as a magic word that wipes away legal obligations.
This article explains, in plain English but with legal precision, what Moroccan law currently says about employment contracts, artificial intelligence and dismissal in Morocco. We will look at the partial legal vacuum, the role of article 66 of the Moroccan Labour Code, the mandatory dismissal procedure, compensation, abusive dismissal arguments, contractual clauses worth negotiating, retraining options through ANAPEC and OFPPT, and the practical path to the social chamber of the Tribunal de Première Instance.
In short: if your employer says your job is gone because of a new algorithm, a robot, an automated platform or an AI-enabled software suite, the law still asks old questions. Was the reason real? Was the procedure followed? Were your rights paid? And if not, what can you do about it?
1. Moroccan law and automation: a partial legal vacuum
1.1 The Labour Code of 2003 facing the challenges of 2024 and beyond
The main source remains Law No. 65-99 relating to the Labour Code. It is a foundational text of Moroccan social law, published in the Official Bulletin n°5210 of 6 May 2004. It regulates the employment relationship from hiring to termination, including wages, leave, disciplinary rules, collective bargaining and economic dismissal.
But the Code was drafted at a time when “digital transformation” mostly meant computerisation, not generative AI, automated decision systems or software capable of replacing full categories of repetitive office work. So the legal architecture exists, but the vocabulary is old. There is no specific chapter on AI in the workplace, no statutory duty to conduct an algorithmic impact assessment before job cuts, no dedicated retraining fund for employees displaced by automation, and no Moroccan equivalent of the European Union’s AI Act in labour matters.
That does not mean there is no law. It means judges, labour inspectors, lawyers and HR departments must work by interpretation. In Morocco, that often happens through broad legal notions such as good faith, real and serious grounds, technological changes and abuse of rights. The result is functional, but imperfect. Employees have arguments. Employers have room to manoeuvre. Litigation becomes highly fact-sensitive.
1.2 What the law says, and what it does not say, about new technologies
The first thing to say clearly is this: Moroccan law does not expressly state that artificial intelligence is a legal cause for dismissal. There is no article saying, in substance, “an employer may dismiss an employee because AI has replaced the role.” Anyone telling you otherwise is oversimplifying.
What the Labour Code does say is more indirect. It recognises economic dismissal in cases linked to economic difficulties, technological changes, restructuring or closure. That wording is broad enough to include automation and AI deployment when they genuinely suppress positions. So the legal route exists, but through interpretation.
It also matters that the Ministry of Economic Inclusion, Small Business, Employment and Skills has not, to date, issued a specific circular dedicated to AI-related dismissals. Morocco’s public policy discourse, including digital transition strategies and the broader ambition of a more digitised economy, is moving faster than labour-specific regulation. In practical terms, employers are innovating before lawmakers have fully updated the social framework.
Compared with some European jurisdictions, Morocco is behind on normative detail. France, for example, has a denser body of case law and procedural expectations around economic redundancies and reclassification. The EU is building broader AI governance. Morocco is still relying on a 2003 Code interpreted in light of 2024 realities. That is manageable for now, but only up to a point.
1.3 Is reform coming?
There is no adopted Moroccan statute yet that specifically reorganises labour law around AI and automation. That said, anyone following the General Secretariat of the Government, the Official Bulletin and ministry policy papers should expect pressure for reform to grow. The debate is no longer theoretical. Once disputes multiply in sectors such as banking, telecoms, BPO, logistics and manufacturing, the legal system will be forced to answer more precise questions.
For the moment, the safest legal reflex is simple: watch the existing Code, watch collective agreements, and watch the Official Bulletin for amendments. In labour law, a small textual change can redraw the balance between employer flexibility and employee protection.
2. Economic dismissal for automation: what article 66 of the Labour Code says
2.1 The legal definition under article 66
The central provision is article 66 of Law No. 65-99. It governs dismissal for technological, structural or economic reasons. This is the legal home of licenciement économique automatisation Maroc, even if the Code uses older language.
Article 66 of the Moroccan Labour Code allows the employer, under defined conditions, to dismiss one or more employees for reasons linked in particular to economic difficulties, technological changes, restructuring or closure.
Those words matter. For an AI-related dismissal to be lawful, the employer must usually show two things at the same time. First, the underlying reason must be real and serious. Second, the mandatory procedure must be respected. If one of those pillars collapses, the dismissal becomes vulnerable to challenge.
In plain terms, a company cannot simply buy software, announce “digitalisation”, and terminate contracts at will. It must be able to explain what changed, which positions disappeared, why the change had an actual operational impact, and why the procedure required by the Labour Code was followed.
The concept of code du travail marocain article 66 licenciement économique therefore becomes crucial whenever AI tools remove a post or a whole function.
2.2 Can automation count as a valid economic ground?
Yes, indirectly. Automation can qualify as a form of technological change under article 66. If an employer introduces AI-powered tools, automated production systems, robotic process automation or software that genuinely eliminates the need for certain tasks, Moroccan law can treat this as a lawful ground for economic dismissal.
Attention, though. The legal ground is not “AI” by itself. The legal ground is the technological change and its economic or organisational consequences. That nuance is important in litigation. The employer does not win merely by proving the existence of a new technology. It must connect that technology to a real suppression of the role.
That is why profitability can become a strategic issue. If the company remains highly profitable, hires in parallel, or replaces the dismissed employee with another human performing substantially the same duties a few months later, the employee may argue that the technological explanation was only a pretext. Moroccan judges in social matters are attentive to the reality behind labels. The wording of article 66 is broad, but not empty.
As of today, Moroccan published case law directly on “AI replacing an employee” remains extremely limited. It is more honest to say almost non-existent than to pretend otherwise. But courts can reason by analogy with disputes involving mechanisation, restructuring or technological reorganisation.
2.3 The mandatory procedure: staff delegates, labour inspection and deadlines
This is where many employers make mistakes. Articles 67 to 71 of the Labour Code set out the procedure. In labour litigation, procedure is not cosmetic. It is often decisive.
Under article 67, the employer must consult employee representatives, notably the délégués du personnel, where they exist. The consultation must address the reasons for the contemplated dismissals, the affected positions and the broader context. A paper trail matters here: meeting notices, minutes, explanatory documents, internal memos. In the absence of serious consultation, the employer starts the dispute from a weak position.
For collective dismissals linked to technological changes or restructuring, article 68 requires notification to the competent authority through the labour inspection process. The employer must seek authorisation through the governor or province process in coordination with the authority in charge of labour. The text is technical, but the practical point is simple: collective economic dismissal is supervised. It is not a unilateral HR formality.
Article 68 provides for administrative oversight of collective dismissals for technological or economic reasons, with a response period commonly referred to as 30 days.
If the employer bypasses this route, the dismissal can be attacked as irregular or abusive. That risk is very real in sectors undergoing rapid digitalisation, where management sometimes moves faster than compliance.
There is also the issue of notice. The rules on notice periods are found in article 43 of the Labour Code, and they apply unless the employee is exempted with payment in lieu. The employee cannot be left with neither notice nor compensation except in cases of serious misconduct, which is a different legal regime entirely.
2.4 A practical example from Fès: automation in a textile plant
Take a plausible case from Fès, a city where textile activity remains economically important. A factory introduces automated cutting and sewing systems that reduce the need for forty operators on one production line. Management invokes technological change. Some employees are terminated. Others are retained and reassigned. The staff delegates complain that they were informed too late, and the labour inspection file is incomplete.
That dispute can quickly land before the social chamber of the Tribunal de Première Instance of Fès. The employer will argue article 66: technological change, productivity, international competition, survival of the business. The employees will argue article 67 and article 68: no proper consultation, no valid administrative process, no transparent criteria, and perhaps no serious search for alternatives.
Who wins? It depends on the evidence. But one thing is constant: when the procedure is not respected to the letter, the employer’s legal position weakens sharply. That is why employees facing this type of situation in Fès may need early advice from labour lawyers in Fès, especially before signing any settlement document.
For readers wanting a broader explanation of the legal framework, the first occurrence of the issue can be explored further under economic dismissal in Morocco.
3. Compensation when AI suppresses a position
3.1 Dismissal compensation under article 52
If the economic dismissal is lawful, the employee is still entitled to statutory payments. The key text is article 52 of the Labour Code, supplemented by Decree n°2-04-469 of 29 December 2004 on calculation methods.
Article 52: dismissal compensation is calculated on the basis of the employee’s wage and seniority, at the rate of 96 hours of wages per year of service for the first five years, 144 hours from the sixth to the tenth year, and 192 hours beyond ten years.
This compensation is distinct from notice compensation and payment for untaken annual leave. In practice, employees often underestimate what is due because employers present a single lump sum without detail. Never accept that blindly. Ask for the breakdown.
This is the heart of the query indemnité licenciement automatisation code travail Maroc: even when automation is a lawful reason, compensation remains governed by ordinary labour law rules unless a collective agreement or employment contract grants more.
3.2 Notice and compensation for untaken leave
Article 43 regulates notice periods. The legal duration varies according to category and seniority, but for the editorial scenario provided, the practical benchmark often used is: 8 days for less than 1 year of service, 1 month from 1 to 5 years, and 2 months beyond 5 years. If the employer does not require the employee to work during notice, it must pay an indemnity in lieu of notice.
In addition, the employee is entitled to compensation for unused paid annual leave. This is frequently forgotten in conflict situations. It should appear on the final settlement documents and can be claimed separately if omitted.
3.3 A concrete calculation: 8 years of service, MAD 6,000 per month
Let us take a realistic Moroccan example. A back-office employee in Casablanca earns MAD 6,000 gross per month and has 8 years of seniority. Assume the dismissal is recognised as a valid economic dismissal linked to automation.
To simplify the calculation, start from the hourly wage. Moroccan practice often uses the monthly wage converted into hours according to the legal working time framework. The exact payroll method should be checked carefully, but the editorial benchmark gives a useful estimate.
For the first five years: 5 x 96 hours = 480 hours of wages.
For years 6 to 8: 3 x 144 hours = 432 hours of wages.
Total: 912 hours of wages.
Using the benchmark commonly applied in examples, this leads to a dismissal compensation estimate of around MAD 33,600 for the dismissal indemnity alone. Then add notice compensation — here, likely 2 months because the employee has more than 5 years of service — plus compensation for any untaken leave.
The final package can therefore exceed the initial figure significantly. Employees should compare the employer’s offer against a proper calculation. For that, a dedicated resource such as this guide on dismissal compensation in Morocco can be useful.
3.4 Collective agreements may improve the legal minimum
The statutory minimum is not always the full story. Sectoral collective agreements, company agreements and internal status rules can provide more favourable compensation. This is particularly relevant in banking, large industrial groups, public-linked entities and some major employers with structured HR policies.
So before signing a departure agreement, check whether your workplace is covered by a collective agreement or internal regulation granting enhanced severance, longer notice, redeployment rights or training support. In Moroccan labour law, employees often focus on the Labour Code and forget the contract-specific layer. That can cost real money.
4. Abusive dismissal: can you challenge being replaced by a robot or algorithm?
4.1 Article 41 and the principle of valid grounds
The legal starting point is article 41 of the Labour Code, which frames the notion that termination without valid grounds can be abusive. In the Moroccan system, the employer does not have unlimited freedom to dismiss. The reason must be lawful, real and sufficiently established.
Article 41 of Law No. 65-99 is a cornerstone in disputes over abusive dismissal: where the alleged ground is not valid or the legal framework is not respected, the termination may be treated as wrongful.
That is where the phrase licenciement abusif remplacement robot Maroc acquires legal significance. If the employer says “AI made the role unnecessary” but the facts show something else, the employee can challenge the dismissal before the social court.
4.2 The strongest arguments employees can raise
The first argument is the absence of a real suppression of the post. If the company dismisses an employee for technological reasons, then hires another person to perform substantially the same functions a few months later, the economic rationale becomes suspect.
The second argument is bad faith. Moroccan labour law is deeply influenced by the principle of good faith in the execution of the employment relationship. Article 24 of the Labour Code is often invoked in this broader sense. If a profitable company uses “automation” as a convenient label to remove older, better-paid employees while maintaining growth and distribution of profits, a judge may scrutinise the seriousness of the ground.
The third argument is procedural irregularity. Even where technological change is real, failure to consult staff delegates, failure to notify the labour authority properly, or failure to pay legal entitlements can support a challenge.
The fourth argument concerns unequal treatment or hidden discrimination. If only a particular age group, union-sensitive group or wage bracket is targeted under the cover of digital transformation, the employee may raise broader social law arguments.
4.3 Who bears the burden of proof?
In practice, the employer bears the heavier burden on the core justification. It must show the reality of the technological change and the necessity of the dismissal. The employee, of course, should bring evidence too: organisational charts, emails announcing the AI deployment, public annual reports, LinkedIn hiring posts, internal notes, screenshots of the software rollout, even training presentations showing that the function still exists but under another title.
This is where litigation is won or lost. Moroccan social judges are pragmatic. They look for documents. A general statement by management that “the company is modernising” will not carry the same weight as procurement contracts, implementation plans, minutes of consultation meetings and proof that the position actually disappeared.
There are decisions of the Moroccan Cour de Cassation, formerly the Supreme Court before 2011, insisting in social matters on the need for employers to justify the factual basis of dismissal and comply with legal procedure. The jurisprudence specifically naming AI is still embryonic, but the principles are not.
For readers dealing with this type of dispute, the broader issue is covered under abusive dismissal in Morocco.
4.4 The limitation period: do not wait too long
Under article 394 of Law No. 65-99, labour claims are subject to a limitation period of two years from the date of termination. This is strict. Once the period expires, your action can be declared inadmissible regardless of the merits.
Article 394: labour-related claims must be brought within 2 years. After that, the claim risks being time-barred.
Concretely, if you believe your AI-related dismissal is abusive, do not spend a year negotiating informally and another year hesitating. Gather documents early and seek advice quickly.
5. What employers should do before dismissing because of automation
5.1 Redeployment and training: not clearly codified, but increasingly expected
Moroccan law does not expressly impose a French-style statutory redeployment obligation before every economic dismissal for technological change. That is the honest answer. But that is not the end of the matter.
Through article 24 on good faith and the general logic of social protection, many labour practitioners argue that an employer introducing automation should at least examine whether the employee can be retrained or reassigned. Some social judges have treated the absence of any effort at adaptation as an element that weakens the employer’s case. It is not a fully autonomous statutory obligation, but it is legally relevant.
That is why obligations employeur digitalisation Maroc should be understood broadly. A prudent employer does not jump directly from software deployment to layoffs. It documents alternatives, internal vacancies, training options and role transformation possibilities.
5.2 Clauses worth negotiating in the employment contract
This is where the topic of contrat de travail Maroc intelligence artificielle becomes concrete. Employment contracts can contain clauses that protect employees better than the statutory minimum, provided they do not violate public-order labour rules.
A contract may include a continuous training clause linked to technological change, a priority redeployment clause if the role is affected by automation, or an enhanced severance clause in case of suppression of the post due to disruptive technologies. These clauses are not exotic. They are smart drafting.
The legal basis is not a specific “AI clause article” in the Labour Code. Rather, it flows from contractual freedom within labour-law limits, combined with the broader framework of professional training and the execution of the employment contract. Employees negotiating senior roles, long-term positions or specialised functions should consider these protections. For a broader overview, see employment contract issues in Morocco.
A useful clause may say, in substance, that where the employee’s position is materially affected by technological change, the employer will first offer reasonable training or examine equivalent internal roles before any termination for economic reasons. Another may provide a severance multiplier above article 52. In practice, many employees never ask. They should.
5.3 Collective bargaining and the role of unions
Moroccan labour law does allow collective bargaining. Articles 92 to 105 of the Labour Code govern collective agreements. This matters greatly for négociation collective intelligence artificielle entreprise Maroc. Where representative unions are active, they can negotiate commitments on consultation, training, redeployment, transparency of technological rollouts and compensation floors.
In sectors such as banking and telecoms, large employers have already integrated training and digital transition language into internal social dialogue. Not always under the label “AI”, true. But the substance is similar: new tools, changing jobs, required upskilling, internal mobility. A good union delegate can secure protections that the statute alone does not expressly grant.
Employees in large organisations should not underestimate this route. Collective bargaining can move faster than Parliament.
Readers interested in that aspect can explore collective bargaining and social dialogue.
5.4 Morocco still lacks a true employment-safeguard plan
Unlike French law, Morocco does not have a fully developed statutory Plan de Sauvegarde de l’Emploi for major technology-driven restructurings. That is a real gap. In large-scale automation scenarios, the current framework is often too binary: either the employer follows the economic dismissal procedure, or it does not. There is less detailed legal engineering around retraining plans, mobility budgets, transition support and post-dismissal accompaniment.
In my view, this is one of the areas where reform is most needed. A modern labour code should not merely regulate the exit. It should organise the transition.
6. Retraining after automation: rights, institutions and reality on the ground
6.1 ANAPEC programmes: what actually exists
If you lose your job because of automation, Moroccan public institutions do offer pathways for retraining, even if none is designed exclusively for AI-related dismissal. The first stop is often ANAPEC, the Agence Nationale de Promotion de l’Emploi et des Compétences.
Programmes such as Taehil and Idmaj can help jobseekers access targeted training and reintegration support. Depending on the profile and region, these programmes can be free or very low cost. Processing time and availability vary, but many candidates can start a pathway within weeks once their file is complete.
This is the practical side of reconversion professionnelle intelligence artificielle Maroc. The law may not guarantee a bespoke AI transition package, but institutions exist and should be used quickly after dismissal.
6.2 OFPPT and digital training tracks
The second major actor is the OFPPT, the Office for Vocational Training and Labour Promotion. It has expanded digital and technology-oriented training offers, including tracks related to data, software, cybersecurity and, increasingly, AI-adjacent skills. Not every centre offers the same level of specialisation, so local verification is necessary.
Training duration can range from roughly 3 months to 18 months depending on the pathway. Public routes remain far more affordable than private certification programmes, which may cost anywhere between MAD 15,000 and MAD 50,000 or more.
The Contrat Spécial de Formation (CSF), linked to the legal framework of vocational training under Law No. 13-00 on the status of vocational training, can also support skills development financing in some contexts. Employees and employers alike often underuse it.
6.3 Is there a right to training before dismissal?
Moroccan law does not create a broad, automatic individual right saying that every employee threatened by automation must be retrained before dismissal. But the legal system does value training and adaptation. Article 23 and the broader labour-law logic around professional development support the idea that employers should not ignore training completely, especially where the position can evolve rather than vanish.
So if your company announces digital transformation, a very practical step is to request training or a skills assessment in writing. That written trace can later matter. It shows that alternatives existed and that you sought adaptation rather than conflict.
6.4 A typical retraining story from Rabat
Consider a 42-year-old bank technician in Rabat whose reporting and verification tasks are gradually absorbed by automated compliance software. Instead of waiting for a termination letter, he asks for internal training. The employer hesitates. He then registers with ANAPEC after dismissal, completes a targeted data-analysis training pathway and, within months, moves into a junior analytics support role in another institution.
Is this guaranteed? Of course not. But it reflects a real truth of the Moroccan labour market: employees displaced by technology often need a bridge, not just severance. And the earlier they start building that bridge, the better.
7. Going to court: how to challenge an AI-related dismissal in Morocco
7.1 The competent court and the first procedural step
The competent court is generally the social chamber of the Tribunal de Première Instance where the work was performed. The procedural framework is found in the Labour Code and the Code of Civil Procedure, especially the rules governing social disputes and conciliation. In practical terms, the case starts with a written claim filed with the court registry.
A conciliation attempt is normally part of the process before a judgment on the merits. Sometimes that stage resolves the dispute quickly. Sometimes it merely clarifies the lines of battle.
If you work in a major city, obtaining local legal advice matters because judicial practice can vary. Depending on your location, you may consult labour lawyers in Casablanca, labour lawyers in Rabat, labour lawyers in Marrakech or labour lawyers in Tangier, especially in industrial and free-zone contexts where automation disputes are likely to grow.
7.2 Documents you should gather immediately
This part is very practical. If you are dismissed because a software tool, platform, robot or AI system allegedly replaced your role, do not leave with only your termination letter.
You should collect your employment contract, any amendments, your last 12 payslips at minimum, the dismissal letter, proof of seniority, internal emails or memos announcing the digital project, screenshots or brochures describing the new system, staff meeting minutes if accessible, and anything showing the company’s financial health. If there were public announcements about expansion or profits, save them too.
Within the first 72 hours after dismissal, a disciplined employee should also ask in writing for the detailed breakdown of the final settlement, including notice compensation, dismissal compensation under article 52, leave balance and CNSS-related documents where applicable. Keep copies of everything. In labour disputes, memory fades, but documents remain.
7.3 Costs and duration
The good news is that court filing costs in Moroccan labour matters remain relatively modest. Basic court fees often stay below MAD 500. The larger expense is usually the lawyer’s fee. For a first-instance dismissal case, legal fees often range between MAD 3,000 and MAD 15,000, depending on complexity, the city and the lawyer’s reputation.
If your means are limited, legal aid may be available through an application filed at the court registry. It is not automatic, but it exists and should not be ignored.
As for timing, a labour case may take roughly 8 to 18 months in first instance. If there is an appeal before the Cour d’Appel, the overall duration can stretch to 18 to 36 months, sometimes more. Conciliation, if successful, can resolve the matter in one to three hearings.
This is the real-world landscape of recours salarié licencié IA tribunal social Maroc: accessible in principle, but requiring patience and evidence.
7.4 Strategy before and during litigation
Not every case should go straight to trial. Sometimes a well-drafted lawyer’s letter, grounded in article 66, article 67, article 68, article 52 and article 394, is enough to move the employer toward a serious settlement. Employers often become more realistic once they understand that the employee knows the procedure and can prove irregularities.
Still, do not sign a settlement in a hurry. Read every line. Check whether you are waiving future claims. Check whether the amount includes all legal entitlements or merely part of them. If the company says, “this is standard”, that is precisely when you should be careful.
Conclusion: Morocco needs clearer rules, but employees already have legal tools
Artificial intelligence is not yet a named category in Moroccan labour law. That is the starting truth. But it does not follow that employers can remove workers without constraint. The current legal framework, especially articles 41, 43, 52, 66 to 71 and 394 of Law No. 65-99, still provides a structure for analysing AI-related job suppression.
In clear terms, Moroccan law can accept automation as part of a lawful economic dismissal under the heading of technological changes. Yet the employer must prove the reality of that change, follow the mandatory procedure, consult where required, and pay every dirham due. If the technological explanation is only a cover story, the dismissal can be challenged as abusive.
What is missing, frankly, is a modern legislative update. Morocco would benefit from a more explicit framework on digital restructuring, redeployment, algorithmic management, retraining duties and collective safeguards. A future article 66 bis, or even a broader labour-and-digital transition reform, would make sense.
Until then, employees should not remain passive. Review your contract. Negotiate training clauses when you can. Keep written proof. Check the applicable collective agreement. And if your post disappears after a new AI tool arrives, do not assume the employer’s version is the legal last word.
If you need tailored advice, consult a Moroccan labour lawyer promptly. The law is imperfect, yes. But remedies do exist, and timing matters.

