When someone asks you to erase their data and part of it sits in a document the law requires you to keep, you keep that document, lock it so it serves only the legal obligation, and erase everything else. Then you reply in writing: what you are keeping, under which statute, and until what date. Morocco's data protection law, Law 09-08, allows exactly this. Its Article 8 grants erasure of data whose processing does not comply with the law, and keeping an invoice for ten years because the General Tax Code demands it is compliant processing.
The exposure runs both ways. A company that fails to keep its accounting records for ten years faces a fine of 50,000 dirhams per financial year (Article 185 bis of the General Tax Code, the CGI). A company that keeps personal data beyond the period set by law or declared to the CNDP, the data protection authority, faces three months to a year in prison and a fine of 20,000 to 200,000 dirhams, or either one of them (Article 55 of Law 09-08). A system that never deletes anything commits the second offence quietly.
What happens when you delete a customer in your ERP?
Try it in your test environment. Create a dummy customer with at least one posted invoice and ask the system to delete it. If the system refuses, your books are safe, but you have no technical way to handle an erasure request. If it deletes or anonymises the customer along with the invoices, it has altered records you must keep intact for ten years. The third outcome is the one you want: the data the accounting records need stays, read-only for finance, and everything else (phone number, preferences, marketing consent) goes.
Then ask your IT team how long data deleted in production survives in backups.
What does Law 09-08 say about erasure?
Article 3 limits how long personal data may be kept to what the purposes of collection require, and Article 15 makes you state that period in your declaration to the CNDP.
Article 4 waives consent where processing is needed to meet a legal obligation. Article 8 gives anyone who proves their identity the right to have data updated, corrected, erased or locked ("verrouillage" in the French text) when its processing does not comply with the law, free of charge and within ten clear days, with notice to any third party the data was passed to. Article 9 adds a right to object, but its first paragraph does not apply when processing meets a legal obligation.
You end up with two tools: erasure for what no longer has a justification, locking for what you must keep. The law does not spell out what locking involves. In practice it means access limited to the people who need the data for the legal obligation, no other use, and a log of every access. Our Law 09-08 compliance guide covers the declaration process.
Which retention periods does Moroccan law set?
This table only lists periods a statute sets expressly. For personnel files, commercial contracts and bank statements, have your lawyer set the period.
| Document | Legal basis | Period | Starting point | When it expires |
|---|---|---|---|---|
| Journal, general ledger, inventory ledger, annual financial statements | Law 9-88, art. 22; CGI, art. 211 | 10 years | Text silent; use the financial year end | Logged destruction, unless on hold |
| Copies of sales invoices, till receipts | CGI, art. 211; Law 9-88, art. 22 | 10 years | Financial year end | Logged destruction, unless on hold |
| Supporting documents for expenses and capital spending | CGI, art. 211; Law 9-88, art. 22 | 10 years | Financial year end | Logged destruction, unless on hold |
| Customer and supplier ledger accounts | CGI, art. 211 | 10 years | End of the last financial year in which the record was used | Erased, unless on hold |
| Business correspondence received (originals) and sent (copies) | Commercial Code, art. 26 | 10 years | Date of each letter | Logged destruction |
| Payroll register, or the system that replaces it | Labour Code, art. 373; CGI, art. 211 | At least 2 years (labour); 10 years (CGI, art. 211, which expressly covers those required to withhold tax at source) | Closing of the register; financial year end for the tax period | Destroyed at the later date |
| Personal data with no legal retention duty (prospects, rejected applicants) | Law 09-08, art. 3 and 15 | As long as the purpose requires, declared to the CNDP | End of the purpose (relationship ends, consent withdrawn) | Erased or anonymised; overrunning it is an offence (art. 55) |
| Personal data inside the documents above | Law 09-08, art. 4 and 9 | Same as the document | Same as the document | Locked, then destroyed with the document |
To test this table against your own systems, we are happy to go through it in a free conversation: your document types, the rule for each, and where that rule gets lost.
When does the clock start?
The Commercial Code runs the ten years for correspondence from the date of each letter, and the Labour Code runs the two years for the payroll register from the day it is closed. Law 9-88 and Article 211 of the CGI say "ten years" without saying from when.
The safe reading counts from the end of the financial year the document belongs to, as that gives the latest date. Take an invoice dated 3 January 2016, with a financial year that follows the calendar year. Counting from the invoice date takes you to 3 January 2026; counting from the year end takes you to 31 December 2026. The tax authority's reassessment window is also set by financial year, running to 31 December of the fourth year after the year end (Article 232 of the CGI).
Your system has to store, for each document, the event that starts the clock: the financial year for an invoice, the sending date for a letter, the end of the relationship for a prospect.
When do you keep a document beyond ten years?
Three situations justify a hold, starting with tax losses. Article 12 of the CGI limits the carry-forward of a loss to the fourth financial year after it, except for the part that comes from depreciation, which carries forward without time limit. Where losses or VAT credits from time-barred years are set off against a period still open, Article 232 lets the tax authority reach back over the last four time-barred years, capped at the amounts used. This extended reach-back normally stays inside the ten-year window, unless the limitation period is interrupted or suspended. As a precaution, keep the records behind a depreciation loss for as long as it is being used, with your statutory auditor's agreement.
During a tax audit, notices from the tax authority interrupt the limitation period, and appeals before the tax commissions and the courts suspend it. A live commercial or employment dispute freezes the documents that serve as evidence in the same way.
In the system, these cases take the form of a hold placed by finance or legal on a financial year or a case file, with a reason and a date. While the hold stands, the purge skips the documents it covers.
Archive or backup: which one stands up as evidence?
Article 417-1 of the Code of Obligations and Contracts, added by Law 53-05, gives electronic documents the same evidential weight as paper, provided the person they come from can be identified and they are created and kept in a way that guarantees their integrity.
A backup exists to restore a system. It gets overwritten in cycles and cannot show that a document is unchanged since it was filed. An evidential archive freezes the document in a stable format, computes a fingerprint (hash) when it is filed, logs every access and carries its expiry date, which a well configured digitisation platform does. Since a restore can bring back data deleted in the meantime, keep an erasure log and replay it after every restore. Our piece on document management versus a shared drive lists the metadata you need.
How do you answer an erasure request without breaking the books?
- Verify the requester's identity, as Article 8 requires.
- Search for the person in every system, including email, document management, shared drives and the email marketing tool.
- Sort each piece of data against the table.
- Erase what no legal duty covers, lock the rest, and notify any third party the data was passed to.
- Reply in writing within the deadline, listing what was erased and, for each document kept, the statute and the expiry date.
- Record the request, the reply and the actions taken in a log.
If you refuse all or part of the request, or miss the deadline, the person can take it to the CNDP. To write these rules and test them in your tools, see our digital consulting service.
A 2019 customer asks to be erased: what must the dealership keep?
A car dealer network with five sites receives an erasure request from a private customer in November 2026. The company and figures are invented for illustration, and its financial year follows the calendar year. The search finds fourteen items: a prospect record in the CRM with its campaign history, a 2019 test-drive form with a copy of the driving licence, the customer account in the ERP, the vehicle sales invoice dated March 2019, six workshop invoices (one a year from 2020 to 2025) and four emails exchanged in March 2019 about the delivery.
Two items are erased. The prospect record no longer serves any purpose and the customer withdraws consent to marketing; the email marketing provider that received the list is notified. The test-drive form and the licence copy fall under no retention duty, and their purpose, the 2019 test drive, was served long ago.
The other twelve are locked. The sales invoice stays until 31 December 2029, ten years after the end of financial year 2019, and the four emails until March 2029. The six workshop invoices expire one by one, the 2020 invoice on 31 December 2030 and the 2025 invoice on 31 December 2035. The ERP customer account, cut down to its accounting data (name, address, ledger account), follows the last invoice and goes on 31 December 2035.
The reply letter lists those twelve documents with their statute and date. If the customer comes back to the workshop in 2027, they become an active customer again; the lock on their account is lifted, and the new invoice pushes its expiry to 31 December 2037, which the system has to recompute on its own.
FAQ
- Can we anonymise an invoice instead of keeping it as issued?
No. Law 9-88 (art. 22) and Article 211 of the CGI require the supporting document itself, the copy of the invoice, to be kept for ten years; an invoice with the customer's name removed is no longer that document. Keep it intact, limit access to finance and audit, then destroy it at expiry with an entry in the purge log.
- Does a digital copy let us destroy the paper originals?
The CGI penalises failure to keep accounting records "or their copy on computer media and, failing that, on paper", and the Code of Obligations and Contracts accepts electronic documents whose integrity is guaranteed. Before you destroy originals, have your scanning process approved by your lawyer and your statutory auditor.
- Does moving to a new ERP reset the clock?
No. The duty follows the document, whatever software holds it. The migration carries the documents, their expiry dates and their holds, or the old system stays available read-only until the last expiry date. Write a full export, with fingerprints and access logs, into the exit terms of the contract.
- What do we tell a former employee who asks us to erase their file?
The payroll register must be kept for at least two years under the Labour Code, and longer for tax. For the rest of the file, the statutes cited here set no period. Claims arising from an employment contract are time-barred after two years (Article 395), so set a period with your lawyer, declare it to the CNDP and apply it.
Sources
- Commercial Code, art. 26 (Adala)
- Law 9-88, art. 22 (reproduced text, unofficial, BEFEC)
- General Tax Code 2026, art. 12, 185 bis, 211 and 232 (DGI)
- Labour Code, art. 373 and 395 (Adala)
- Law 09-08, art. 3, 4, 8, 9, 15 and 55 (Adala) and CNDP
- Law 53-05, art. 417-1 of the Code of Obligations and Contracts (Adala)
Last verified: 2 November 2026.
This table summarises statutes; your lawyer signs off on the starting points and on the periods specific to your business. An invoice issued in a financial year that closes on 31 December 2026 stays in your archive until at least 31 December 2036, counting from the year end.





