
695 P.2d 1255 (1985)
107 Idaho 1116
INTERNATIONAL EQUIPMENT SERVICE, INC., and American and Foreign Insurance Company, Plaintiffs-Appellants, Cross-Respondents,
v.
POCATELLO INDUSTRIAL PARK COMPANY, a corporation, Defendant-Respondent, Cross-Appellant.
No. 15204.
Supreme Court of Idaho.
February 13, 1985.
*1256 W. Marcus W. Nye, of Racine, Olson, Nye, Cooper & Budge, Chartered, Pocatello, for plaintiffs-appellants, cross-respondents.
Charles L. Hay, Cascade, for defendant-respondent, cross-appellant.
McFADDEN, Justice Pro Tem.
International Equipment Service (IES) entered into a lease agreement with Pocatello Industrial Park Company (PIPCO) wherein IES leased an industrial building from PIPCO for one year. The lease provided that the lessor, PIPCO, would maintain the roof and other structural components in good repair. The lease also provided that the lessee would obtain insurance and that, to the extent a loss was insured, the parties waived their right of recovery against each other.[1]
In July, 1973, while PIPCO employees were replacing part of the roof, rain leaked into the leased building and damaged IES's property. American and Foreign Insurance Company (AFI) paid IES $80,878.00 as compensation for the rain damage. On January 14, 1975, AFI, as subrogee to the rights of IES, brought a negligence action against PIPCO to recover the compensation paid.[2]
IES failed to pay rent under the lease from April to December, 1974. IES filed bankruptcy on January 2, 1975, in California. PIPCO's claim for back rent in the amount of $39,967.15 was listed as a debt in the bankruptcy proceeding and was discharged. IES's potential claim against PIPCO for the rain damage was listed as an asset.
On March 30, 1982, the district court granted PIPCO partial summary judgment in the action brought by AFI. The court ruled that PIPCO was entitled to set off the $39,967.15 in back rent, plus $22,110.03 *1257 in accrued interest, against any damages awarded to AFI at trial. The court also granted a partial summary judgment to AFI on the issue of liability under the lease agreement. The summary judgment prohibited PIPCO from raising the lease provisions as a defense to PIPCO's duty to maintain the roof.
The case was tried to a jury. On March 19, 1983, the jury returned a special verdict finding PIPCO 75% negligent and IES 25% negligent and setting IES' damages at $80,878.90. AFI moved for reconsideration of the partial summary judgment allowing PIPCO to set off the back rent against the damages awarded. The court entered judgment on August 26, 1983, awarding AFI $60,659.18 in damages and affirming its allowance of the offset. (Because the rent and interest exceeded the damages awarded, AFI did not receive any sum for damages.)
AFI filed this appeal asserting that the trial court erred in allowing PIPCO to set off its claim for back rent against the damages awarded to AFI at trial. PIPCO cross-appealed arguing that the trial court should have ruled, as a matter of law, that IES waived its right to recover for the rain damage under Paragraph XI(5) of the lease agreement. We will address each issue in turn.

I.

Setoff
Appellant, AFI, asserts that because respondent's claim for back rent under the lease was discharged in bankruptcy, it cannot be used as a setoff in the present action. The question of whether a debt discharged in bankruptcy can be set off in a post-petition proceeding appears to be one of first impression in Idaho. Former § 32 of the Bankruptcy Act, which was in effect when IES filed for bankruptcy in 1975, provided that an order of discharge operates to "enjoin all creditors whose debts are discharged from thereafter instituting or continuing any action or employing any process to collect such debts as personal liabilities of the bankrupt." 11 U.S.C. § 32(f)(2) (1970).[3]
Section 32 clearly bars any attempt by a creditor to affirmatively recover a discharged debt. However, it does not prevent a creditor from using the debt as a setoff against any recovery sought by the bankrupt against the creditor, so long as both claims accrued prior to bankruptcy. Binnick v. AVCO Financial Services of Neb., 435 F. Supp. 359 (D.Neb. 1977); Kaufman's of Kentucky v. Wall, 383 S.W.2d 907 (Ky. 1964).
The Wall case, supra, is very similar to the present action. In that case, as in the case at bar, the plaintiff listed a negligence claim against defendant as an asset in her bankruptcy petition. Among the debts listed was a sum owing to the defendant. That debt was subsequently discharged. The plaintiff pursued the negligence claim in her own name following the bankruptcy. The defendant sought to set off the amount plaintiff owed him against the negligence award. The court allowed the setoff stating: "while a bankruptcy proceeding, prosecuted to a successful conclusion, may discharge a person from personal liability as to a debt listed therein, such a discharge does not prevent the creditor from using the debt as a setoff against any recovery sought by the bankrupted debtor against the creditor." 383 S.W.2d at 908.
We agree with the court in Wall that a discharge in bankruptcy should operate as a shield against affirmative recovery, not as a sword enabling a debtor to *1258 take undue advantage of the fact of the discharge. Id. Setoff is an equitable doctrine. It is based on the principle that where two parties are mutually indebted, justice requires that the debts be set off and that only the balance is recoverable. See 20 Am.Jur.2d Counterclaim, Recoupment, and Set Off § 7 (1965). In our view, equity requires that PIPCO be allowed the offset in the present case. It would be inequitable to allow AFI to receive the benefit of IES's right to recover against PIPCO without requiring it to assume the corresponding burden of PIPCO's claim for back rent against IES.
Appellants next assert that setoff was improper because the requisite mutuality of parties is lacking in this case. It is appellant's position that because PIPCO's claim for back rent is against IES, rather than AFI, there is no mutuality of parties and, thus, setoff is improper. Appellants' argument misconceives the nature of a subrogation action.
"Equitable subrogation is a legal device which permits a party who has been required to satisfy a loss created by a third party's wrong to step into the shoes of the loser and recover from the wrongdoer." Transit Cas. Co. v. Spink Corp., 94 Cal. App.3d 124, 132, 156 Cal. Rptr. 360, 365 (1979). See generally, 73 Am.Jur.2d Subrogation § 106 and cases cited therein. Through subrogation, an insurance carrier, like AFI, is entitled to recoup a loss inflicted on its policyholder which it has paid pursuant to the insurance contract.
As this Court recognized in Houghtelin v. Diehl, 47 Idaho 636, 639, 277 P. 699, 700 (1929), the doctrine of subrogation encompasses a complete substitution of rights: "Subrogation, in its broadest sense, is the substitution of one person for another, so that he may succeed to the rights of the creditor in relation to the debt or claim and its rights, remedies and securities." However, this substitution of rights is not without corresponding limitations. It is often said that the subrogee "stands in the shoes of the subrogor." As such, the subrogee can acquire no greater rights than the subrogor possessed and is subject to the same burdens and limitations. Any defenses which the creditor has against the subrogee may also be asserted against the subrogor. See State, By & Through Healy v. Smither, 290 Or. 827, 626 P.2d 356 (1981); Timms v. James, 28 Wash. App. 76, 621 P.2d 798 (1980); Barnes v. Hampton, 198 Neb. 151, 252 N.W.2d 138 (1977). See generally, 73 Am.Jur.2d, supra.
Thus, the very nature of subrogation creates the necessary mutuality of parties in this case. AFI stands in the shoes of IES and, therefore, the trial court was correct in allowing PIPCO to offset its claim for back rent against the damages awarded to AFI at trial.

II.

Waiver
Respondent, PIPCO, has cross-appealed asserting that the trial court should have ruled, as a matter of law, that IES waived its right to recover for the rain damage under Paragraph XI(5) of the lease agreement. Because we have determined that the offset for back rent was properly allowed, we find it unnecessary to reach this issue. The amount of the offset allowed exceeded the amount of damages awarded at trial. Thus, regardless of the nature of the lease provisions, the effect of our decision today is that AFI will not recover for the rain damage.
The decision of the trial court is affirmed.
Costs on appeal to respondent.
No attorney fees on appeal.
DONALDSON, C.J., and SHEPARD, BAKES and BISTLINE, JJ., concur.
NOTES
[1]  The disputed lease provisions provide as follows:

Part VIII
"1. Lessor agrees to maintain foundation, roof, exterior walls and other structural components of the building, and the grounds and roadways, in good order and condition during the term of this lease.
"... .
Part XI
"1. Lessee agrees to indemnify and hold Lessor harmless against any and all liability for injury to or death of persons, or loss of or damage to property of Lessee or others, arising from the Lessee's possession or use of the leased premises, howsoever occurring, except as a result of Lessor's sole negligence.
"... .
"5. Anything in this lease to the contrary notwithstanding, the lessor and lessee hereby mutually agree to waive their rights of recovery against each other or against each other's employees who may be responsible for a loss to the property of either of them to the extent that any such loss shall be covered under a fire insurance policy or policies, including the perils of the extended coverage endorsement, vandalism, and malicious mischief."
[2]  AFI insured IES against the type of loss involved herein, and, having paid for the damages suffered by IES, is subrogee to IES' damage claim. While this action was initiated solely by AFI, IES was later joined as party plaintiff.
[3]  The Bankruptcy Act was reformed in 1978 and § 32 was replaced by § 524. The specific language of § 524(a)(2) appears to prohibit setoff of a discharged debt against a post-petition judgment.

"(a) A discharge in a case under this title 
"(2) operates as an injunction against the commencement or continuation of an action, the employment of process, or any act, to collect, recover or offset any such debt as a personal liability of the debtor, or from property of the debtor, whether or not discharge of such debt is waived... ." 11 U.S.C. § 524(a)(2) (1979) (emphasis added).
