Short answer. Yes. Civil Code Article 5 makes acts against mandatory or prohibitory laws void, except when the law itself authorizes their validity. If the very law your contract appears to violate also carves out an exception permitting that arrangement, the contract falls within the exception and is not void on that ground.

What the law says

Acts executed against the provisions of mandatory or prohibitory laws shall be void, except when the law itself authorizes their validity.

Civil Code, Article 5 — Acts Against Mandatory or Prohibitory Laws Are Void. Read the full provision →

The general rule: void, not just voidable

Article 5 states the consequence of defying a mandatory or prohibitory law in the plainest possible terms: acts executed against the provisions of mandatory or prohibitory laws shall be void. A mandatory law commands that something be done in a particular way; a prohibitory law forbids something outright. An act, including a contract, that runs contrary to either kind of law does not merely carry some defect that a party can choose to overlook, it is treated as void, meaning it produces no legal effect from the start, as though the parties had never validly agreed to it at all.

The exception written into the same sentence

The article immediately qualifies its own rule: acts are void except when the law itself authorizes their validity. This exception is narrow by design. It is not enough that the parties believed their arrangement was reasonable, or that some other law generally favors freedom of contract; the specific law being violated has to be the source of the authorization. Where that same law expressly permits the arrangement despite what looks like a conflict with its own general command, the exception applies and the act is not void on that basis.

Why the source of the exception matters

Because the exception has to come from the law itself, identifying it requires reading the actual text of the mandatory or prohibitory law in question, not just its general policy or purpose. A law can be mandatory in its general rule while still building in defined circumstances, conditions, or classes of persons for which it permits a departure. If your contract fits squarely within language the law uses to authorize that kind of arrangement, Article 5's exception is what keeps the contract valid rather than void, and the analysis turns entirely on whether that authorizing language actually covers your situation.

Cases citing this provision

These Supreme Court decisions cite the provision above. We list them so you can read them yourself; the summaries of what each decided are not ours to give.

Related provisions

Note. Statute text quoted on this page is reproduced from the official enactment and is linked to the full provision. The explanation around it is general legal information from Vivas & Nobles Law Office, not legal advice. Whether it applies to your situation depends on facts only a lawyer reviewing them can assess.