
644 N.W.2d 1 (2002)
Elizabeth OPPERMAN, Appellant,
v.
M. & I. DEHY, INC., Appellee.
No. 00-1314.
Supreme Court of Iowa.
May 8, 2002.
*2 John F. Lorentzen and Debra L. Hulett of Nyemaster, Goode, Voigts, West, Hansell & O'Brien, P.C., Des Moines, for appellant.
A. Eric Neu of Neu, Minnich, Comito & Neu, P.C., Carroll, for appellee.
LAVORATO, Chief Justice.
Elizabeth Opperman sued M. & I. Dehy, Inc. (M. & I.) in equity to rescind and cancel a mortgage on property owned by Elizabeth. Elizabeth and her husband, Ivan, executed a promissory note and the mortgage in question to M. & I., a corporation owned by their son, John. The court held that Elizabeth failed to prove the mortgage was without consideration as she had contended and denied her relief. The court awarded M. & I. attorney fees and costs.
Elizabeth appealed and we transferred the case to the court of appeals, which agreed with Elizabeth's contention that the note and mortgage were without consideration. The court held that the district court erred in (1) denying Elizabeth's petition to rescind and cancel the mortgage and (2) awarding M. & I. attorney fees and costs.
M. & I. filed an application for further review, which we granted. We find the mortgage was not supported by valid consideration. However, we apply the maxim of "clean hands" to deny relief to the parties. We therefore vacate the court of appeals' decision and affirm in part and *3 reverse in part the district court's judgment.
I. Scope of Review. Because this is an equitable action, our review is de novo. Norwest Bank Nebraska v. Philips Realty Co., 594 N.W.2d 3, 6 (Iowa 1999). Although we are not bound by the district court's factual findings, we give weight to those findings, especially when witness credibility is in issue. Iowa R.App. P. 6.14(6)(g); Norwest Bank Nebraska, 594 N.W.2d at 6. Because the district court had the witnesses before it, we think it was in a far better position to judge their credibility. Hatheway v. Hanson, 230 Iowa 386, 396, 297 N.W. 824, 828 (1941).

II. Facts.
Besides John, Elizabeth and Ivan have a son, Jim, a daughter, Valarie Opperman Roberts, and three other daughters. In 1985, M. & I. became an active corporation. Jim and John Opperman owned the company in 1990. The main business of the corporation is alfalfa processing.
Also in 1985, Delray, Inc. (Delray) was formed for the sole purpose of purchasing farmland owned by Ivan. At that time, the farmland was subject to litigation and perhaps foreclosure by Farm Credit Services. The initial ownership of Delray is not clear from the record. Jim testified that he was the owner of Delray in 1990, but John testified he owned at least half and up to 100 percent of Delray.
Valarie Opperman Robertsthe two brothers' sisterowned a house in Manning, Iowa. She lived there a short time and moved sometime during the 1980s. The house remained unoccupied until 1990, and was in need of major improvements. During this time, Ivan and Elizabeth needed a place to live. The two sons and their parents decidedwith Valarie's approvalthat the parents could live in Valarie's house provided the necessary improvements were made.
By 1990, Ivan and Elizabeth had lost almost all of their assets and were living off social security benefits and a small weekly salary Ivan received from M. & I. John and Jim decided that Delray would purchase the house from Valarie and that M. & I. would pay for the necessary improvements because it had a monthly cash flow from its operations. Delray had only an annual income.
By the purchase and improvements, the two sons intended to place their parents in a comfortable home during their retirement years. John and Jim never intended to seek reimbursement for the improvements. Nor was it their intention to sell the Manning property to their parents or to charge them rent.
Improvements were made to the Manning property beginning in 1990, while Valarie still owned the property. John and Jim signed checks drawn on M. & I.'s account to pay for the improvements. At this point in time, there was no agreement for the parents to pay for the house or the improvements. John testified that at the time the improvements were made during 1990 and 1991, he did not care whether Delray repaid M. & I. for amounts spent on the improvements. This was so, he testified, because both he and Jim owned the two companies, which made it "like moving money from your left ... pocket and putting it in your right pocket."
The parents moved into the Manning property in 1991, and since then have never paid any rent. In April 1992, Delray purchased the Manning property on contract from Valarie and her husband for $18,000. A warranty deed to Delray in satisfaction of the contract was recorded on August 12, 1993. The parents made no agreement to repay amounts Delray paid to purchase the home.
*4 In 1993, John decided to expand his farm operations to include a hog confinement operation. Jim and John agreed that a thirty-acre tract of farmland owned by Delray would be set aside for the operation, but John was to obtain the necessary financing. Delray transferred without consideration the thirty acres to M. & I. for use in the hog confinement operation.
After John failed to obtain the necessary financing for the hog confinement operation, he suggested Delray mortgage the Manning property. At the time, due to the improvements, the property was appraised at $80,000, which supported a $44,000 loan. Delray used the $44,000 to pay off a mortgage on the thirty acres to be set aside for the hog confinement operation, pay Valarie the balance of the purchase price for the Manning property, and finance the purchase of assets for the hog building. At the time of trial, Delray was current on the monthly payments toward satisfaction of the mortgage securing the $44,000 loan. John and his wife are personally liable on this debt.
In 1995, Ivan learned about a program offering home improvement subsidies. The subsidies were available to low-income homeowners. Because these subsidies were not available to a non-owner of real estate, Ivan suggested Delray deed the Manning property to him. Delray quitclaimed the Manning property to Ivan on May 17, 1995. The deed, recorded in May 1995, stated, "[t]he consideration for this deed is less than $500 and therefore is exempt from the tax imposed by Chapter 428A of the 1995 Code of Iowa, as amended." Jim and John, as president and secretary of Delray, respectively, signed the deed.
Shortly after Delray transferred the Manning property to Ivan, one of Ivan's unsecured creditors, a bank, threatened to collect his outstanding obligation to the bank by pursuing Ivan's interest in the property. Ivan told Jim and John about the creditor's threat, which prompted a discussion on how to avoid a loss of the real estate to the creditor.
As a result of that discussion, Ivan executed a promissory note, and mortgage securing the note to M. & I. Ivan executed the note and mortgage on June 1, 1995, in the amount of $35,000. The note indicated it was "finally and fully due, owing and payable on June 1, 2020." The note bore a ten percent interest rate, but made no provisions for periodic payments of interest or principal. The mortgage provides that it was given as security for a promissory note dated June 1, 1995, for $35,000, which has a due date of June 1, 2020. The mortgage was recorded on June 8, 1995. On the same date, Ivan quitclaimed the Manning property to Elizabeth.
Jim and Ivan testified that John arrived at the $35,000 figure by subtracting the first mortgage ($44,000) from the appraised value of the property ($80,000). John testified the $35,000 amount represented the costs incurred by M. & I. in fixing up the Manning property, but admitted M. & I. incurred at least another $7,000 in expenses.
The evidence supports a finding that the parties never intended that Ivan would pay the note or that M. & I. would ever foreclose on the mortgage. This becomes evident from the note's due date of 2020. The parties arrived at the due date of 2020 because it was far enough in the future that Elizabeth and Ivan would likely be deceased by that time and the home would revert back to Jim and John, the owners of M. & I. at the time of the mortgage.
John testified that he and Jim did not want to "give[ ] up the house," so the mortgage and note were "interpreted that *5 through default down the road ... Jim and I would get [the house] ... because at that time Delray and M. & I. were still fifty percent owned by both of us." In contrast, Jim and Ivan testified that the Manning property and the improvements were a gift to Ivan.
Ownership of M. & I. and Delray became the subject of litigation in the mid 1990s. In 1996, following a settlement, John became sole owner of M. & I., and Jim became sole owner of Delray.
After Ivan and Elizabeth executed the 1995 promissory note and mortgage, John's relationship with his parents deteriorated. John and his parents have not spoken to each other since 1995. The final blow came when Elizabeth omitted John from her will, leaving her estate to be divided among her remaining children. So if Elizabeth is successful in this suit, John would have no interest in the property upon his parents' deaths.

II. Issues.
On appeal, Elizabeth contends the district court erred in refusing to rescind and cancel the mortgage. In support of her contention, she argues the district court erred in holding that she failed to prove the mortgage was not supported by consideration.
Not surprising, M. & I. contends there was sufficient consideration for the mortgage. In the alternative, M. & I. seeks to uphold the district court's ruling on the ground that if fraud was involved, we should leave the parties where they stand. The alternative ground is based on the equity maxim of "clean hands," a theory M. & I. pled and a theory to which the district court gave serious consideration in refusing Elizabeth relief.

III. Consideration.
Elizabeth contends that the mortgage is not enforceable because it was not supported by any consideration. M. & I. contends, and the district court found, that the improvements funded by M. & I. were sufficient consideration for the mortgage in question.
A. Applicable law. A mortgage is not valid and binding unless supported by sufficient consideration. 54A Am.Jur.2d Mortgages § 29, at 616 (1996). "The consideration can be either a benefit to the promisor or a detriment to the promisee." Id. Moreover,
[t]he consideration need not always move from the mortgagee to the mortgagor at the time of the execution of the mortgage. On the contrary, a precedent obligation or debt, as between the parties, is sufficient of itself to support the mortgage. Also, the consideration for a mortgage may consist of a loan to a third person.
Id. at 617; see also CBS Real Estate of Cedar Rapids, Inc. v. Harper, 316 N.W.2d 170, 176 (Iowa 1982) ("A precedent obligation... constitutes consideration for a mortgage.").
B. Analysis. The evidence is uncontroverted that neither Ivan nor Elizabeth expressly agreed to pay for the improvements made to the Manning home. Nor was there any evidence that the two sons ever intended that their parents pay for the improvements. In addition, the deed to Ivan was a gift not only of the property but the improvements in question as well. The notation on the deed that the consideration for it was less than $500 supports this finding. Therefore, at the time Ivan and Elizabeth signed the note and mortgage, there was no pre-existing debt in the form of an agreement to pay for the improvements to serve as consideration *6 for the mortgage. This alleged pre-existing debt forms the sole basis for M. & I.'s claim that consideration supported the mortgage. The district court therefore erred in finding that Elizabeth failed to prove a lack of consideration for the mortgage.

IV. The Clean Hands Maxim.
Although the mortgage lacked consideration, we think for reasons that follow the facts here call for the application of the equity maxim of clean hands.
A. Applicable law. The equity maxim of clean hands
expresses the principle that where a party comes into equity for relief he or she must show that his or her conduct has been fair, equitable, and honest as to the particular controversy in issue. A complainant will not be permitted to take advantage of his or her own wrong or claim the benefit of his or her own fraud or that of his or her privies.
27A Am.Jur.2d Equity § 126, at 605 (1996).
The maxim means
that whenever a party who seeks to set the judicial machinery in motion and obtain some equitable remedy has violated conscience or good faith, or another equitable principle in prior conduct with reference to the subject in issue, the doors of equity will be shut, notwithstanding the defendant's conduct has been such that in the absence of circumstances supporting the application of the maxim, equity might have awarded relief.
Id.
What underlies the maxim is the principle that "equity will not aid an applicant in securing or protecting gains from wrongdoing or in escaping its consequences." Id. at 605-06 (emphasis added).
The maxim "is ordinarily invoked to protect the integrity of the court where granting affirmative equitable relief would run contrary to public policy or lend the court's aid to fraudulent, illegal or unconscionable conduct." Myers v. Smith, 208 N.W.2d 919, 921 (Iowa 1973).
The clean hands maxim need not be pleaded; the district court may apply the maxim on its own motion. Id. Here, as mentioned, M. & I. pled the maxim as an affirmative defense and the district court discussed the maxim in its ruling.
Courts have generally applied the maxim in situations where there has been a conveyance to hinder, delay, or defraud creditors. See, e.g., Shaw v. Addison, 239 Iowa 377, 395-99, 28 N.W.2d 816, 826-27 (1947) (where decedent during his lifetime transferred farm to his sister to escape a possible deficiency judgment he was fearful would be rendered against him in foreclosure action involving another farm, conveyance was in fraud of creditors, and would not be set aside upon suit by administratrix of his estate); Pursifull v. Interstate Oil & Gas Corp., 293 Ky. 152, 168 S.W.2d 363, 365-66 (1942) (corporation created to take title to general manager's property to put it beyond reach of creditors was precluded by "clean hands" maxim from maintaining an action to cancel assignment of such property by general manager to general manager's brother); Moore v. Carter, 356 Mo. 351, 201 S.W.2d 923, 929-30 (1947) (where wife intentionally had legal title to realty placed in name of her husband to protect realty from her own creditors, and, after her husband's death, she intentionally permitted record to continue to show ownership of realty in her husband's name while waiting for claims of her creditors to be barred by statute of limitations, she was precluded by clean hands maxim from prevailing in a cross action in equity to quiet title in her-self *7 under a resulting trust); Wickham v. Simpler, 198 Okla. 580, 180 P.2d 171, 175 (1946) (where plaintiffs' decedent during his lifetime entered into agreement with defendants' decedent concealing knowledge of notes and mortgage for purpose of putting them out of reach of creditors of plaintiffs' decedent, plaintiffs were precluded from obtaining money judgment on the notes and foreclosing the mortgage under the clean hands maxim); Nyswanger v. Roberts, 67 S.D. 362, 293 N.W. 187, 187-88 (1940) (woman who transferred homestead to defraud creditors and who thereafter falsely testified in creditor's action that the conveyance was for consideration, could not subsequently admit falsity of the testimony given in the creditor's action and have conveyance set aside on ground it was made without consideration because clean hands maxim was applicable).
In such situations, a court of equity will leave the parties "in the position in which they have placed themselves, refusing affirmative aid to either of the fraudulent participants." Shaw, 239 Iowa at 398, 28 N.W.2d at 827 (citation omitted); accord England v. England, 243 Iowa 274, 277, 51 N.W.2d 437, 439 (1952). This applies "not only as to the original parties to the fraudulent transaction, but also as to their heirs and all other persons claiming under them." Shaw, 239 Iowa at 398, 28 N.W.2d at 827.
B. Analysis. As mentioned, shortly after Delray transferred the Manning property to Ivan, one of Ivan's unsecured creditors threatened to collect Ivan's outstanding debt to it by pursuing Ivan's interest in the Manning property. The evidence is clear that this threat prompted the note and mortgage. The inescapable conclusion is that the parties simply wanted to hinder the creditor from collecting on the debt Ivan owed to it by pursuing Ivan's interest in the property.
Ivan and Elizabeth executed the note and mortgage on June 1, 1995. The note and mortgage were recorded on June 8. The same day Ivan quitclaimed the Manning property to Elizabeth.
The subject matter of the present suit is the mortgage on the Manning property. Elizabeth is seeking affirmative relief to rescind and cancel the mortgage. She is claiming the Manning property under Ivan. The clean hands maxim would bar Ivan from any affirmative relief to cancel the mortgage because it was given to hinder his creditor. The same maxim likewise bars Elizabeth who claims the Manning property under Ivan.
The mortgage in question was given to M. & I., the alter ego of John, who was a party to the scheme to hinder Ivan's creditor from collecting the debt Ivan owed to it. M. & I. should therefore be barred from any relief. M. & I. has not asked for any affirmative relief relative to the mortgage other than attorney fees as provided for in the mortgage. We apply the clean hands maxim to bar M. & I. from collecting attorney fees. The district court therefore erred in awarding such fees.

V. Disposition.
Because we find there was no consideration for the mortgage, we reverse the district court's contrary ruling.
The note and mortgage were given to hinder Ivan's creditor from pursuing Ivan's interest in the Manning property to satisfy Ivan's debt to his creditor. For this reason we apply the clean hands maxim to deny relief to the parties, in effect leaving the parties where we find them. We therefore will not grant Elizabeth's request to rescind and cancel the mortgage. On this point we affirm the district *8 court ruling but for a different reason. We reverse the district court's ruling awarding attorney fees to M. & I. because we apply the clean hands maxim to deny it any relief.
DECISION OF COURT OF APPEALS VACATED; DISTRICT COURT JUDMENT AFFIRMED IN PART AND REVERSED IN PART.
All justices concur except STREIT, J., who takes no part.
