This action by plaintiff, Robert Taylor, against the defendant, Phyllis Frost, is founded upon three theories. First, plaintiff seeks the repayment of loans in the amount of $21,011.19, made by plaintiff to the defendant during the period of July 9, 1974, to October 10, 1976. Under the second theory, plaintiff seeks the recovery of the same money upon the premise of the existence of a constructive trust founded upon unjust enrichment, it being alleged that the money was advanced for the express purpose of purchasing a residence in Fremont, Nebraska, which would be the home of the parties when they married; it is further alleged that, for convenience when the residence was purchased, the defendant was made grantee in the deed which was delivered on September 5, 1974; and that the engagement between the parties was terminated by the defendant and she has refused to convey the property or return the money to plaintiff. The third theory appears to be that of resulting trust. The prayer of the petition was for the declaration that the defendant held the property for the plaintiff and that the property be ordered conveyed to the plaintiff.
The answer of the defendant admits the money was received by her, and asserts two defenses: (1) The money advanced was by way of gift or payment made in consideration of meretricious sexual services rendered by her to the plaintiff, and (2) the de*654fendant is barred from obtaining relief either in law or in equity because he comes into court with unclean hands.
During the pendency of the action the property was, by agreement of the parties, sold and the net proceeds of the sale were, also by agreement, substituted for the real estate. The matter was tried to the court which found generally for the plaintiff and rendered judgment in his favor for the net proceeds of the sale of the property with accrued interest. We affirm the judgment of the trial court.
The evidence tends to establish the following facts. Although the parties never lived together, they had engaged in sexual intercourse clandestinely beginning sometime in early 1971 until sometime in 1976. This action was commenced in 1977. When the parties first became acquainted in the summer of 1970, Phyllis was married and contemplating divorce from her husband. In February 1971, she commenced an action for divorce. According to Robert’s testimony, this is when the sexual relations commenced and it was during a period of time when they contemplated marriage. According to Phyllis, sexual relations commenced in October of 1970. A decree of divorce was entered in July 1971. However, before it became final, Phyllis had the decree set aside on October 22, 1971. Sexual relations between the parties continued even after the decree was vacated. They stopped seeing each other for a period of about 9 months ending in October 1973, at which time Robert testified that Phyllis called and said they could “make a go of it.” In July 1974, Phyllis again filed a divorce action and a second decree of divorce was entered on September 27, 1974. During the time preceding the filing of the second petition, the evidence indicates that Robert gave Phyllis various gifts and money, as he was to do later. However, none of these gifts or funds are money or property here involved.
*655The first of the advances of money used for the purchase and improvement of the residence in question was $1,200 paid on July 9, 1974, which at-that time was for the purpose of enabling Phyllis to make a downpayment on a duplex (not the property here involved) for use as a residence for Phyllis and her children “until she and I were married.” However, that purchase did not take place. Sometime later, before the conveyance of September 5, 1974, the parties made a joint decision to purchase the property here involved. Phyllis used $1,000 of the $1,200 previously mentioned to make the earnest money payment. Later Robert furnished the balance of the downpayment in the amount of $8,000, and from time to time thereafter furnished additional funds for carpeting, drapes, landscaping, house payments, and other improvements. In all, Robert furnished more than $21,000 which indisputably was used for the house in question. At the time the contract was entered into, the house was still in the process of construction.
Robert testified he furnished the money because they were going to be married and with the understanding that the house would then be their home.
Phyllis testified the money constituted gifts given for sexual services and that she was “prostituting [herself] for this house.” Phyllis, however, acknowledged she was contemplating marriage with Robert and that “sometimes” she contemplated the use of the residence as “our” home.
Robert purchased engagement and wedding rings in about February 1976 and later gave the engagement ring to Phyllis. She wore it from time to time but returned it later in the year.
Without setting forth the testimony of the parties in detail, it was clearly sufficient to permit the trial judge to find that the parties did have an agreement to marry, that Robert advanced the money to Phyllis because he intended the property to be their *656home when they married, and that Phyllis understood and agreed with this plan. It is plain the trial court did not believe Phyllis’ testimony that there was a bargain between the parties that money invested in the property was in exchange for sexual services.
The above evidence was sufficient to permit the court to find either a resulting trust or a constructive trust. Kuhlman v. Cargile, 200 Neb. 150, 262 N. W. 2d 454; Jirka v. Prior, 196 Neb. 416, 243 N. W. 2d 754. The judgment must be affirmed unless either of the two defenses are good. That is the question which we here decide.
As to the first defense that the contract was in consideration of meretricious sexual services, the parties do not cite and we cannot find any Nebraska precedents directly on point. We adopt the following rule: “A bargain in whole or in part for or in consideration of illicit sexual intercourse or of a promise thereof is illegal; but subject to this exception such intercourse between parties to a bargain previously or subsequently formed does not invalidate it.” Restatement, Contracts, § 589, p. 1098. Cougler v. Fackler, 510 S. W. 2d 16; Corbin on Contracts, § 1476, at p. 622. The evidence we have earlier recited would permit the trial court to find that the illicit sexual intercourse between the parties was not in whole or in part in consideration or exchange for the money advanced to pay for the residence. It may be the parties would not have contemplated marriage except for having engaged in illicit sexual relations. However, that conduct began long before the parties contemplated the purchase of a home. If Robert’s testimony is believed, then such relations and their continuance were no part of a bargain for the advancement of the funds necessary to purchase and improve the property.
The second defense offers considerably more difficulty. It is a sound public policy to protect the mar*657ital relationship from interference, and agreements which interfere with the relationship are ordinarily unenforceable. Breiner v. Olson, 195 Neb. 120, 237 N. W. 2d 118; Morgan v. Wright, 219 Ga. 385, 133 S. E. 2d 341.
When the parties to this action began their sexual relationship, and when they first contemplated marriage in 1971, Phyllis was a married woman and not free to contract marriage. That status continued until 6 months after September 27, 1974. Robert acknowledges he knew Phyllis was not free to marry. Robert was unmarried throughout this relationship.
Ordinarily one who seeks the help of a court of equity must come into equity with clean hands. This doctrine is founded upon public policy and conflicting public policy considerations may require relaxation or limitation of the application of that equitable maxim. Lloyd v. Gutgsell, 175 Neb. 775, 124 N. W. 2d 198. As we have noted, Phyllis, while still married, claims to have made a contract of prostitution in order to gain a house. Such contracts by a married person are also contrary to the public policy which is designed to protect marriage, as well as the legislative public policy making prostitution illegal. If we were to hold that the “clean hands” maxim enables one in her claimed position to keep her “illegal” gains, then that would also tend to “interfere with the marriage relationship and might promote fraud. All things considered, we believe the trial court was correct in relaxing the application of the clean hands doctrine in this case.
The plaintiff has cross-appealed, urging that he have judgment for the amount he expended in the purchase and improvement of the home, rather than the net amount after deducting the expenses of the sale. Without respect to the abstract merits of plaintiff’s claim as to the proper measure of damages, we believe the stipulation of the parties forecloses the claim. It recites “. . . the purpose hereof *658is to substitute the net sale proceeds of the real estate in lieu of the real estate ...” Other language of the stipulation might arguably support the conclusion that the net proceeds were to be applied to the judgment. The amount contributed was a matter of proof. The latter provision would seem to apply if the judgment were for less than net proceeds. The trial court apparently interpreted the stipulation in this manner. We do not intend to change it.
Affirmed.