An agreement may possess all the requisite elements of a valid contract, such as offer and acceptance and consideration, but be unenforceable because it is illegal. The diversity of legal rules that can be breached and the wide scope of public policy make this branch of the law of contract rather complex. Contracts may be illegal at the time of their of their formation or because of the way they have been performed.
Illegal at time of formation
Contracts may be illegal when entered into because they cannot be performed in accordance with their terms without the commission of an illegal act. This type of illegality was illustrated in the case of Levy v Yates (1838).
Illegal mode of performance
In some cases, a contract may be perfectly legal when it is made, but may be carried out in an illegal manner. This was the case in Anderson Ltd v Daniel (1924).
Violation of legal rules and public policy
A contract is clearly illegal where its formation, purpose or performance involves the commission of a legal wrong. But the law relating to illegal contracts extends beyond this as it also involves conduct which the law disapproves of as contrary to the interests of the public, even though that conduct is not actually unlawful.