The law will not enforce all contracts. There are some categories of contract to be wary of. Where a contract is illegal, this may affect its enforceability. Contracts may be illegal under common law principles or they may be illegal under legislation.
Contracts illegal under common law
The law regards some kinds of contracts as illegal because they involve moral wrongdoing or reprehensible conduct.
Examples are contracts to commit a crime, to jeopardise the revenue, which are a danger to public safety or international relations, which undermine the administration of justice, which are corrupt and so forth.
If a party to such a contract seeks a court’s help to enforce, the court will simply refuse to do so.
Contracts illegal under statute
Contracts that are illegal by statute may be regulated as to enforceability by the legislation, so the statute will need to be read and interpreted.
Contracts absolutely prohibited by statute will be void, whether the parties know of the illegality or not.
However, where one party performs an otherwise legal contract in a manner that breaches legislation, the other party, if having no knowledge of the facts giving rise to the illegality, may still be able to enforce the contract or recover damages for breach of it.
Or a court may decide that the contract is unenforceable because of the illegality.
The law about illegal contracts is complex and often difficult to apply. Because there are so many legislative provisions affecting very many aspects of life, it is possible for a contract to be tainted by illegality (perhaps even unknown to the parties).
Whether such a contract will or will not be enforced by the courts has generated a great deal of contradictory case law.