For example, the contract itself may be prohibited by statute; it may have a purpose which is illegal; or performance of the contract may involve commission of a crime. However, the application of the doctrine of illegality to these situations and others has caused great uncertainty, complexity and inconsistency. On 16 and 17 February 2016 the Supreme Court had the opportunity to clarify the law in the case of Mirza v Patel  UKSC 42 on appeal from the English Court of Appeal.
The facts of Mirza were reasonably straightforward. Mr Patel transferred £620,000 to Mr Mirza for the purpose of betting on the price of RBS shares, using insider information which Mr Mirza expected to obtain from RBS contacts. However, Mr Mirza's contacts did not come through for him and so the proposed insider trading did not take place. However, Mr Mirza did not return the money to Mr Patel. The agreement between the parties was illegal in terms of section 52 of the Criminal Justice Act 1993 which prohibited any conspiracy to commit an offence of insider dealing.
The agreement having failed, Mr Patel raised action against Mr Mirza for recovery of his money basing his claim both in contract and unjustified enrichment. At first instance, the Judge had applied the "reliance principle" found in Tinsley v Milligan  1 AC and held that Mr Patel's claim to recover the money was unenforceable because he had to rely on his own illegality to establish it. Further, he could not rely on the exception to that rule because he had not voluntarily withdrawn from the illegal scheme. The Court of Appeal agreed with the Judge in principle but differed from him on the exception, taking the view that it was enough for his claim to succeed that the illegal contract had not been implemented. Accordingly, Mr Mirza appealed to the Supreme Court.
The Supreme Court was acutely conscious of the need for clarification of the law in this area and a full bench of nine Judges heard the appeal. The Judges were unanimous insofar as the result was concerned - Mr Patel should be entitled to recover his money. However, they were far from unanimous in relation to the important question of what the proper test should be in order for the illegality defence to apply. The present rule was based on the reliance test in terms of which the question asked by the court is whether the person making the claim is obliged to rely in support of it on an illegal act on his part. If he is then his claim is barred failing the exceptions applying.
Lord Toulson (supported by Lady Hale, Lord Kerr, Lord Wilson and Lord Hodge) was of the view that this test had failed to provide certainty and that, therefore, a more flexible approach was required focussing on the essential rationale of the illegality doctrine - i.e. that it would be contrary to the public interest to enforce a claim if to do so would be harmful to the integrity of the legal system.
Lord Toulson continued to say that in assessing whether the public interest would be harmed, it was necessary to consider (a) the underlying purpose of the prohibition which has been transgressed and whether that purpose will be enhanced by denial of the claim; (b) any relevant public policy on which the denial of the claim may have an impact; and (c) whether denial of the claim would be a proportionate response to the illegality, bearing in mind that punishment is a matter for the criminal courts. Within that framework, various factors may be relevant but it was clear that a principled and transparent assessment of these factors was a better and fairer way of deciding the matter than by the application of a formal rule which has, in the past, produced results which have at times appeared arbitrary, unjust or disproportionate.
Lord Neuberger, Lord Mance, Lord Clarke and Lord Sumption all wrote separate decisions. They each took the view that there was no inconsistency with the usual rule in allowing Mr Patel to recover his money from Mr Mirza even though they had been party to an illegal agreement. The basis for that was the restitution was possible. Accordingly, it was possible to return the parties to the original position that they had been in as if no illegal contract had ever been made. Lord Neuberger also agreed with Lord Toulson that the principled approach he outlined was as reliable and helpful an approach as it was possible to give in relation to the illegality rule.
Lord Mance, Lord Clarke and Lord Sumption, however, considered that their decisions allowing an exception to the rule where restitution was possible meant that there was no need to change the long standing reliance test. Lord Sumption in particular was very critical of the principled approach and suggested that the courts should not be required to weigh or balance the various consequences of granting relief. The principled approach suggested by the majority was simply turning the exercise into a discretionary decision by the court which, in turn, would lead to uncertainty with some Judges inevitably being more censorious than others in their decision-making. Indeed, he pointed to decisions which illustrated that a principled approach would degenerate into "instinctive judicial preference of one party over the other". Essentially, the Supreme Court was replacing a bad old rule with a bad new one.
It is not difficult to see the attraction of the minority's approach from the standpoint of legal certainty. A principled approach will inevitably lead to a wide-range of decisions depending on the particular Judge hearing the case which makes it difficult for solicitors and counsel to properly advise their clients on their prospects of success in such an action. Nonetheless, it is that approach that now prevails - Tinsley v Milligan is disapproved and, at last, we have some clarity in relation to the law of illegality - or do we?