
211 Cal.App.3d 1104 (1989)
260 Cal. Rptr. 6
AHMAD S. HOMAMI, Plaintiff, Cross-defendant and Respondent,
v.
MANSOOR IRANZADI et al., Defendants, Cross-complainants and Appellants.
Docket No. H003970.
Court of Appeals of California, Sixth District.
June 26, 1989.
*1106 COUNSEL
Brian Fortune Gill for Defendants, Cross-complainants and Appellants.
Eugene Epstein and Shostak & Epstein for Plaintiff, Cross-defendant and Respondent.
OPINION
BRAUER, J.
Ahmad S. Homami sued Mansoor Iranzadi to collect the balance due on a promissory note. Iranzadi claimed he had paid down the principal balance by approximately $40,000. Homami acknowledged receiving that amount but claimed the payments represented interest only. The note expressly provided: "This note shall bear no interest." But Homami testified at trial that the parties nonetheless had an oral agreement for the payment of 12 percent interest per annum. According to Homami the no interest provision on the note was only so that he could avoid reporting the income for state and federal income tax purposes.
The trial court granted judgment in favor of Homami. We reverse on the basis that Homami's claim is dependent upon an agreement for the express purpose of violating the law and defrauding state and federal governments.

FACTS
Homami and Iranzadi were brothers-in-law. At the time of this transaction, they had been involved in various business dealings together both in Iran and in the United States.
On January 9, 1984, Homami wrote a check for $250,000 to California Land Title in order to fund a real estate transaction on behalf of Iranzadi. The close of escrow was delayed until March 22, 1984. In the interim Homami kept the money available to make the loan.
The $250,000 loan was evidenced by two identical promissory notes dated March 22, 1984, in the amount of $125,000 each. Each note provided that it was all due and payable in two years and each recited that it would *1107 bear no interest. One note was secured by property known as the "Pinehill" property, and the other by property known as the "Outlook" property.
Iranzadi, who was not fluent in English, had granted Homami a power of attorney. Pursuant to this power Homami routinely wrote checks for his brother-in-law.
On March 25, 1984, three days after the loan was funded, Homami signed a check to himself for $2,104.68 on Iranzadi's account. The check bore a notation in Persian that it was for interest to March. According to Homami, this amount represented interest lost to him by virtue of the fact that he had kept the $250,000 accessible for two and a half months. He testified that Iranzadi had agreed to pay him the difference between the interest he was earning in his regular bank account and the 12 percent he would be receiving from Iranzadi.
Thereafter, checks were drawn to Homami on Iranzadi's account more or less on a monthly basis for approximately a year. For the first few months Homami signed the checks. The last six checks were signed by Iranzadi's son. With the exception of two payments, all of the checks were for $2,500. That would be the exact amount of monthly interest on a debt for $250,000 bearing a rate of 12 percent per annum. The total amount paid to Homami from Iranzadi, including the initial payment of $2,104.68, was $39,324.68.
On March 18, 1985, Homami and Iranzadi signed a document entitled "Modification Agreement" for each of the promissory notes. The modification agreements were identical except for their reference to the respective notes and deeds of trust. Each provided for the following modification of terms:
"1. The note shall be all due and payable on or before September 22, 1985.
"2. The note shall bear no interest until June 22, 1985.
"3. On June 22, 1985, interest shall commence at the rate of eighteen percent per annum; said interest shall be payable monthly commencing on July 22, 1985 and continue monthly thereafter until the maturity date expressed herein."
Thereafter, two more payments of $2,500 were made, on May 22, 1985, and June 23, 1985. No further payments of any amount were made.
On August 14, 1985, Homami filed notices of default on the ground that Iranzadi had failed to pay the monthly installment of interest due July 22, 1985. Foreclosures were commenced on both properties. Iranzadi found a *1108 buyer for the Pinehill property and escrow closed at the end of January, 1986. Homami was paid through that escrow the full principal balance of $125,000 on the one note, plus interest at 18 percent from June 22, 1985, as per the modification agreement, and foreclosure fees; however, Iranzadi expressly reserved the right to claim a credit for approximately $40,000, plus fees and costs, against the second note.
The Outlook property sold in June 1986. Homami submitted a demand for the full $125,000 plus interest on that amount from June 22, 1985, and foreclosure fees. Iranzadi, maintaining he had paid $39,324.68 on the principal balance between March 1984 and June 1985, claimed a credit in that amount. Escrow closed but the sum of $43,500 was held out of the proceeds and delivered to Albert Ham, a stakeholder, pending resolution of the dispute.
Homami filed suit October 15, 1986, alleging breach of a written contract. Attached to the complaint were the two promissory notes and modification agreements. Iranzadi filed a cross-complaint for declaratory relief, alleging that he had paid $39,324.68 towards reducing the principal, and seeking a determination of rights as to the monies held in trust. He also pleaded a cause of action for conversion of the $39,324.68 and prayed for compensatory relief and punitive damages against Homami.
At trial Homami testified that he and Iranzadi had orally agreed on an interest rate of 12 percent, and had also agreed that Iranzadi would not report interest paid and Homami would not have to report receiving the income. He testified that this arrangement was discussed and reiterated at a family meeting March 15, 1985. And he specifically stated that the reason the loan documents did not reflect any interest was so that he could avoid reporting income to the Internal Revenue Service.
Iranzadi, on the other hand, claimed that he and Homami had never discussed interest on the loan. He testified that in family dealings interest was never charged and that he had often loaned money to Homami without interest. He stated that he had authorized Homami to take $2,000 to $3,000 from his account every month to reduce the principal balance.
The trial court found that the payments made by Iranzadi to Homami totalling $39,324.68 represented interest only, and no principal reduction. Therefore Iranzadi still owed Homami that amount on the loan. The court rendered judgment in favor of Homami for $39,324.68 plus interest at 18 percent from June 30, 1986, the close of escrow, plus attorneys fees and costs. The judgment ordered that Albert Ham, the stakeholder, be awarded *1109 $588.11 for his costs and that he distribute the balance in the trust account to Homami in partial payment of the judgment.

DISCUSSION
Iranzadi raises a number of issues involving pleading defects, the statute of frauds, the parol evidence rule, and claimed error in an evidentiary ruling. He also makes the argument that a contract which has as its object an illegal purpose is contrary to public policy and void. Since we find the last point to be dispositive, we need not address the remaining issues.
The Civil Code provides a starting place. A contract must have a lawful object. (Civ. Code, § 1550.) Any contract which has as its object the violation of an express provision of law is unlawful. (Civ. Code, § 1667, subd. 1.) The object of a contract is the thing which it is agreed, on the part of the party receiving the consideration, to do or not to do. (Civ. Code, § 1595.) The object must be lawful when the contract is made. (Civ. Code, § 1596.) And that part of the contract which is unlawful is void. (Civ. Code, § 1599.)
Courts have interpreted these statutes liberally. (1) "`The general principle is well established that a contract founded on an illegal consideration, or which is made for the purpose of furthering any matter or thing prohibited by statute, or to aid or assist any party therein, is void. This rule applies to every contract which is founded on a transaction malum in se, or which is prohibited by a statute on the ground of public policy.'" (C.I.T. Corp. v. Breckenridge (1944) 63 Cal. App.2d 198, 200 [146 P.2d 271].)
It makes no difference whether the contract has been partially or wholly performed. Rather, the test is "`"whether the plaintiff requires the aid of the illegal transaction to establish his case. If the plaintiff cannot open his case without showing that he has broken the law, the court will not assist him, whatever his claim in justice may be upon the defendant."'" (C.I.T. Corp. v. Breckenridge, supra, 63 Cal. App. 198, 200.)
Nor does it matter that the illegality has not been pleaded. "[I]f the question of illegality develops during the course of a trial, a court must consider it whether pleaded or not.... `Whenever the evidence discloses the relations of the parties to the transaction to be illegal and against public policy, it becomes the duty of the court to refuse to entertain the action.'" (Russell v. Soldinger (1976) 59 Cal. App.3d 633, 642 [131 Cal. Rptr. 145].)
Cases which have applied these principles fall into several broad categories. A common situation involves the unlicensed contractor, or other *1110 unlicensed professional, who seeks to collect money for services rendered. Courts have routinely refused to grant relief in such cases on the ground that the failure to comply with licensing requirements violates a law designed to protect and benefit the public. Therefore a party who has violated the law and entered into an agreement to perform services while unlicensed cannot obtain the aid of courts to enforce the agreement. (Loving & Evans v. Blick (1949) 33 Cal.2d 603, 607 [204 P.2d 23]; Franklin v. Nat C. Goldstone Agency (1949) 33 Cal.2d 628 [204 P.2d 37]; Harrison v. Butte Steel Buildings, Inc. (1957) 150 Cal. App.2d 296 [310 P.2d 126]; Mansfield v. Hyde (1952) 112 Cal. App.2d 133, 138-139 [245 P.2d 577].)
In another factual context, courts have refused to grant relief to parties seeking to collect monies arising from illegal gambling activities. (Lee On v. Long (1951) 37 Cal.2d 499 [234 P.2d 9]; Fong v. Miller (1951) 105 Cal. App.2d 411 [233 P.2d 606].)
A third group of cases closer to our facts involves plaintiffs who have attempted to circumvent federal law. Generally these cases arise where nonveterans seek to obtain government benefits and entitlements available to veterans only, either by setting up a strawman veteran or otherwise by falsifying documents.
For example, in May v. Herron (1954) 127 Cal. App.2d 707 [274 P.2d 484], the Newmans transferred property to a veteran for the sole purpose of obtaining a veteran's priority under Federal Priorities Regulation No. 33. That regulation provided that veterans who wished to build houses for their own occupancy would receive preferential treatment in obtaining construction materials. The Newmans had been advised to obtain the illegal veteran's priority by their building contractor, who then entered into a contract with the veteran to build a house which he knew the Newmans intended to occupy. When the builder sued to recover a balance due on the construction contract, the court refused to come to his aid, finding that he had "initiated, suggested and directed a conspiracy to violate and circumvent a federal regulation which had the force of law." (Id. at p. 711.) The court concluded in this vein: "To permit a recovery here on any theory would permit plaintiff to benefit from his wilful and deliberate flouting of a law designed to promote the general public welfare." (Id. at p. 712.)
In a similar case, Lala v. Maiorana (1959) 166 Cal. App.2d 724 [333 P.2d 862], plaintiffs conveyed real property to defendant without consideration or a change of possession. Defendant, by virtue of his status as a serviceman, obtained a loan on the property. He continued to hold title although plaintiffs occupied the property and made all the loan payments. Eventually creditors of defendant filed liens on the property. Plaintiffs sought to be *1111 relieved of those liens, claiming that the property was rightfully theirs. But in order to prove their claim, plaintiffs had to disclose the illegal purpose behind the conveyance to defendant. Because of that, the court refused to grant them relief.
Young v. Hampton (1951) 36 Cal.2d 799 [228 P.2d 1, 19 A.L.R.2d 830], also involved an agreement for the purpose of circumventing federal legislation. In that case Helen Young, a contractor, agreed to build a house for Hampton, a veteran. She gave him a bid for $8,500 and he applied for a veteran's loan. The Veterans' Administration appraised the project at $8,283 and agreed to make a loan limited to that amount. Hampton and Young then executed a contract to build the house for $8,283 and also signed a side agreement by which Hampton was to pay Young cost plus 10 percent, not to exceed $9,000. When Young was not fully paid, she filed a mechanic's lien based upon the cost plus contract and sued for the balance due. The Supreme Court found that "the entire transaction was designed to evade the provisions of the act (the Servicemen's Readjustment Act) and also to obtain its benefits." (Id. at pp. 805-806.) The secret agreement between Young and Hampton to pay more than the value insured by the VA violated public policy and was therefore unenforceable.
A final example is the case of Moore v. Moore (1900) 130 Cal. 110 [62 P. 294]. In that case a father occupied certain public land and was qualified under the law to homestead the property. Without the father's knowledge, his son made a homestead entry, in the son's own name, falsifying an affidavit and violating homestead regulations. When the father discovered this, the two entered into an agreement that the son would convey title to the father when the patent was issued to him. The son acquired title but died without conveying the property, whereupon the father sued to obtain title on the theory that the son held title in trust for him. But since the father could not establish his case without showing that he had endorsed the illegal transaction, the court refused to impose a trust. "That the agreement between the father and son was for the consummation of a fraudulent imposition upon the government there can be no doubt, and plaintiff's right of recovery under his pleading looks to the enforcement of this illegal contract." (Id. at p. 112.)
(2) The message from these cases couldn't be clearer. As the Supreme Court has expressed it: "`No principle of law is better settled than that a party to an illegal contract cannot come into a court of law and ask to have his illegal objects carried out; nor can he set up a case in which he must necessarily disclose an illegal purpose as the groundwork of his claim.'" (Lee On v. Long, supra, 37 Cal.2d 499, 502.)
*1112 (3a) We do not perceive any meaningful difference between the unlawful agreements described in the above example and the tax evasion scheme perpetrated by Homami and Iranzadi in our case. Here Homami entered into a written agreement which specifically provided that he would be paid no interest. The purpose of the provision was to enable him to avoid compliance with state and federal income tax regulations. He then secretly collected interest income which he had no intention of reporting. And when a dispute developed, he sought the aid of the court to enforce the secret agreement so that he could keep the money he had collected.
Homami has taken the position that he was not seeking enforcement of the side agreement to pay 12 percent interest; rather he was simply suing to collect the principal balance due on the promissory note plus interest at 18 percent as per the written modification agreement. He points out that neither the promissory notes nor the modification agreements are facially illegal. And he claims that the issue of the $39,324.68 paid was first raised as a defense and was not necessary to pleading or proving his case on the written documents.
(4) First, even though a written contract is legal on its face, evidence may be introduced to establish its illegal character. (May v. Herron, supra, 127 Cal. App.2d 707, 710-711.) And if the substance of the transaction is illegal, it matters not when or how the illegality is raised in the course of the lawsuit. Whether the evidence comes from one side or the other, the disclosure is fatal to the case. (Russell v. Soldinger, supra, 59 Cal. App.3d 633, 642; Loving & Evans v. Blick, supra, 33 Cal.2d 603, 607.) (3b) The fact is that Homami, in order to state his claim to the funds held out of the escrow proceeds, was obliged to testify and did testify that he collected interest secretly in order to circumvent income tax laws. As the cases have repeatedly pointed out, "the test ... is whether the plaintiff can establish his case otherwise than through the medium of an illegal transaction to which he himself is a party." (Schur v. Johnson (1934) 2 Cal. App.2d 680, 683-684 [38 P.2d 844].) It is clear that Homami could not do so.
Finally Homami points out that the parties are in pari delicto; therefore, he argues, Iranzadi should not be allowed to reap an unexpected benefit from the transaction. His complaint is a familiar cry of plaintiffs who find that they have been wronged by their companions in illegal ventures. (Fong v. Miller, supra, 105 Cal. App.2d, 414-415.) Such a plea is always unavailing for this reason: the rule that courts will not enforce illegal agreements is not applied in order to correct injustice between the parties, "but from regard for a higher interest  that of the public, whose welfare demands that certain transactions be discouraged." (Haruko Takeuchi v. Schmuck (1929) 206 Cal. 782, 786-787 [276 P. 345].) Even though a defendant may be left in *1113 possession of some benefit he should in good conscience turn over to plaintiff, that consideration is outweighed by the importance of deterring illegal conduct. "Knowing that they will receive no help from the courts and must trust completely to each other's good faith, the parties are less likely to enter an illegal arrangement in the first place." (Harrison v. Butte Steel Buildings, Inc., supra, 150 Cal. App.2d 296, 301.)
Because his agreement violated the law, Homami is not entitled to the $39,624.86 he collected as unreported interest. That amount is to be credited to Iranzadi from the escrow proceeds. Distribution of the balance of the funds held in the trust account is to be determined by the court on remand.

DISPOSITION
Judgment in favor of plaintiff Homami is reversed, and the matter is remanded to the trial court for further proceedings. Homami is to bear costs of appeal.
Agliano, P.J., and Cottle, J., concurred.
Respondent's petition for review by the Supreme Court was denied September 20, 1989.
