Usually, in this class of cases, the mistake - if there be a mistake - is one of law. Such must inevitably be the case when the illegality of the contract results from the character of the contract itself or of the performance contemplated by it - as in gambling contracts or contracts to commit a crime. When the illegality results from the character or condition of the contractor, however, the mistake may be either one of law or one of fact. Thus, a contract by a corporation for the purchase of certain securities may be illegal, not because contracts for the purchase of such securities are unconditionally prohibited, but because the holding of such securities in excess of a certain limit is forbidden; and in such a case, the mistake of the plaintiff in selling the bonds in reliance upon the ultra vires contract may arise either from ignorance of the prohibition - a mistake of law, - or ignorance of the extent of the company's holdings - a mistake of fact.

1 If the illegal contract is fully performed on both sides there is no basis for quasi contractual obligation. See Stansfield v. Kunz, 1901, 62 Kan. 797; 64 Pac. 614.

Although, in most jurisdictions, money paid under a mistake of law as a general rule may not be recovered (ante, Sec. 35), the doctrine has rarely been applied to cases in which the mistake of law consisted of a mistake as to the legality of the contract in the performance of which the money was paid.1