
439 A.2d 481 (1981)
Arthur R. HENDERSON, et al., Appellants,
v.
SNIDER BROS., INC., et al., Appellees.
Oliver A. COWAN, Jr., Appellant,
v.
Arthur R. HENDERSON, et al., Appellees.
Nos. 13271, 13876.
District of Columbia Court of Appeals.
Submitted October 6, 1980.
Decided December 16, 1981.
*483 Mose Lewis, III, Washington, D. C., for appellants in No. 13271 and appellees in No. 13876.
Jeffrey M. Frost, Chevy Chase, Md., for appellees Snider Bros., Inc., et al., Profit Sharing Trust.
Michael A. Schuchat, Washington, D. C., for appellees Abraham H. Goldkind, Helen Goldkind, Ely Weinkranz and Lena Weinkranz.
Richard W. Galiher and Loren Kieve, Washington, D. C., for appellees in No. 13271 and appellant in No. 13876.
Before KELLY, KERN, NEBEKER, HARRIS, MACK, FERREN and PRYOR,[*] Associate Judges, and YEAGLEY and GALLAGHER,[**] Associate Judges, Retired.
YEAGLEY, Associate Judge, Retired:
These cases present the issue of whether a Maryland decree effecting a sale in foreclosure of property owned by appellants[1] precludes appellants' subsequent suit in this forum asserting that they had been fraudulently induced to purchase the property (No. 13271) and, secondly, whether one of their partners violated his fiduciary duty to the partnership and is guilty of misrepresentation. The trial court found that collateral estoppel applied to bar the fraud claim and dismissed that portion of the complaint. Appellants cite that dismissal as error.[2] Appellant Cowan in No. 13876 cites the trial court's failure to dismiss the breach of fiduciary duty and misrepresentation claims against him as error.
A majority of a division of this court reversed the trial court's decision in No. 13721 on the ground that the doctrine of collateral estoppel is not applicable to the facts in issue. The panel affirmed in No. 13876 the trial court's denial of appellant's motion to dismiss the breach of fiduciary duty and misrepresentation claims.[3]
A petition for rehearing en banc by appellee Snider Bros., Inc. (No. 13271) and by appellant Cowan (No. 13876) was granted, and the divided panel decision was vacated. Finding that the trial court's rulings were correct, we affirm.
On February 14, 1973, Drs. Henderson, Statom, Blackwell, Hyde, Edwards, and West and their respective wives formed a partnership with Oliver Cowan and his wife to purchase the Parkview Towers Apartments in Takoma Park, Maryland. The partnership then purchased the property from Messrs. Goldkind and Weinkranz and their wives for $1,860,000. The purchasers *484 assumed a wrap-around mortgage of approximately $1,450,000, tendered $110,000 in cash, and executed two deferred purchase money notes to the sellers, the first in the amount of $249,222.54, and the second for $50,000. Snider Bros., Inc. served as real estate brokers for the sale. It later also became the holder of the notes. Cowan was an employee of Snider Bros.
For various reasons, the investment turned bad. The doctors had understood that the revenues generated by the apartments would be sufficient to maintain the property and retire the notes  however, such was not the case.
In July 1975, appellants discovered that the $50,000 note had been negotiated by the sellers to their partner, Cowan. They made no further payments on the note. In January 1976, Snider Bros. informed appellants that it held that note and that the balance due was $37,959.64. The note was apparently then negotiated to Snider Bros., Inc. Profit Sharing Trust.[4]
Appellants filed this suit in Superior Court against the sellers, Snider Bros., Inc. and Cowan on February 11, 1976.[5] The suit alleged that Cowan, as an agent of Snider Bros. fraudulently induced appellants to enter into the purchase agreement by representing to them that the investment was a good one; that they would be making a fixed, limited investment for the purpose of acquiring a tax shelter; that the property would be self-sustaining; and that he, Cowan, would have no interest in the property other than that of a partner, and that he would be receiving no commission from the sale. Appellants alleged that the purchase price was $367,000 more than the actual value of the property.
On March 2, 1976, the sellers initiated foreclosure proceedings in a Maryland court and appellants did not contest the foreclosure. At the ensuing public auction, the sellers purchased the property, subject to existing encumbrances. The foreclosure sale was ratified by the court on April 26, 1976. After the auditors' report was filed, appellants filed exceptions thereto and apprised the Maryland court of the pendency of their fraud action in Superior Court, requesting that any monies awarded to them in the fraud action be considered in reduction of any deficiencies under their promissory notes.
On March 22, 1977, the Maryland court modified and ratified the auditors' report, which found a deficiency under note # 1 of $162,764.14, and under note # 2, the sum of $28,758.68. There was no appeal from either the final order of ratification of the foreclosure sale or from the order ratifying the auditors' report, as modified.
On August 11, 1977, appellees filed a motion in the Superior Court of the District of Columbia to dismiss appellants' fraud action on the basis of res judicata. After initially denying the motion, the trial court, relying on the doctrine of collateral estoppel, ultimately granted the motion on the fraudulent inducement claim as to all defendants (appellees) including Cowan, but denied Cowan's motion to dismiss on the fiduciary duty and misrepresentation claims. Although the ruling on Cowan's motion was not a final judgment, the trial court, pursuant to D.C.Code 1973, § 11-721(d), certified that an immediate appeal on the ruling on Cowan's claim would advance the ultimate termination of the case. Cowan's appeal was consolidated by this court with the appeal from the dismissal order.
It is irrelevant for the purpose of our res judicata analysis that the nature of the two proceedings is different. When the parties are the same, and the essence of the claim and the evidence necessary to establish it are the same, res judicata applies. See World Wide Imported Car Co., Ltd. v. Savings Bank of Baltimore, 41 Md.App. 263, 270-72, 396 A.2d 547, 551 (1979), quoting *485 Klein v. Whitehead, 40 Md.App. 1, 389 A.2d 374 (1978).
The doctrine of res judicata (direct estoppel) requires that a valid, final judgment when rendered on the merits be considered an absolute bar to a subsequent action based on the same claim or demand between the same parties. Collateral estoppel, on the other hand, precludes relitigation of issues which were litigated in a previous, but different, cause of action involving a party to the prior litigation. Montana v. United States, 440 U.S. 147, 153, 99 S.Ct. 970, 973, 59 L.Ed.2d 210 (1979); Cromwell v. County of Sac, 94 U.S. 351, 24 L.Ed. 195 (1878). See 1B MOORE'S FEDERAL PRACTICE ¶ 0.405[1], at 621 (3d ed. 1974). Under the doctrine of res judicata ". . . a judgment estops not only as to every ground of recovery or defense actually presented in the action, but also as to every ground which might have been presented. . . ." Cromwell v. County of Sac, supra at 383.
Both parties agree, and we so hold here, that Maryland law controls our determination of the applicability of res judicata or collateral estoppel.[6] Whether res judicata or collateral estoppel applies depends on whether the same, or a different cause of action is the subject of the second suit.
Here, the first proceeding to go to judgment was the action in Maryland seeking foreclosure and a dollar deficiency on the promissory notes growing out of the sale of real estate. The instant action attacks the sale of the property to appellants as fraudulent in that the value of the property was misrepresented to them, and the rental income did not cover costs as represented. This claim necessarily involves an attack on the validity of the sales price and therefore goes to the validity of the promissory notes involved in the foreclosure. The evidence necessary to support a judgment for appellants in this action for damages for fraud would have sufficed to establish a defense of fraud in the foreclosure action.
Maryland law has long held that a judgment ratifying the sale of property in foreclosure proceedings is res judicata to a subsequent cause of action attacking the validity of such sale. Since the fraud issue could have and should have been raised in the foreclosure proceedings, all questions which the mortgagor had concerning misrepresentation as to the sales price, and the validity of the sale have been finally adjudicated, and cannot now be raised. Hohensee v. Minear, 259 Md. 603, 606-07, 270 A.2d 776, 778 (1970); Bacharach v. Washington United Cooperative, 181 Md. 315, 320, 29 A.2d 822, 825 (1943).
The Maryland Court of Appeals has said:
One aspect of direct estoppel is that a party must raise all defenses he has to a cause of action and once that action is concluded he cannot use a defensive matter as a basis for relief in a subsequent action between the parties. [Singer v. Steven Kokes, Inc., 39 Md.App. 180, 182, 384 A.2d 463, 465 (1978), citing Ashman v. Ashman, 201 Md. 445, 450-51, 94 A.2d 257, 259 (1953).]
See 50 C.J.S. Judgments § 682 (1947). See also Bainder v. Sound Building & Loan Association, 161 Md. 597, 158 A.2d 2 (1932).
In the landmark case of Cromwell v. County of Sac, supra at 352-53, the Supreme Court said:
Thus, for example, a judgment rendered upon a promissory note is conclusive as to the validity of the instrument and the amount due upon it, although it be subsequently alleged that perfect defences actually existed, of which no proof was offered, such as forgery, want of consideration, or payment. If such defences were not presented in the action, and established by competent evidence, the *486 subsequent allegation of their existence is of no legal consequence. The judgment is as conclusive, so far as future proceedings at law are concerned, as though the defences never existed. The language, therefore, which is so often used, that a judgment estops not only as to every ground of recovery or defence actually presented in the action, but also as to every ground which might have been presented, is strictly accurate, when applied to the demand or claim in controversy. Such demand or claim, having passed into judgment, cannot again be brought into litigation between the parties in proceedings at law upon any ground whatever.
Appellants contend, however, that the doctrine of res judicata should not apply because of Md.R.Civ.P. 314, the permissive counterclaim rule, and that an omitted permissive counterclaim can be raised in a subsequent action.
However, the defense of fraud is not an independent claim and cannot be considered as being separate and distinct from the underlying agreement and the obligation sued upon. The fraud alleged in this case is not a counterclaim which could be raised at a time and place of appellants' choice, but is a defense which is lost if not raised in the foreclosure proceeding. Hohensee v. Minear, supra; see C.J.S. Judgments § 682 (1974).
It has been suggested that the United States Supreme Court opinion in Mercoid Corp. v. Mid-Continent Investment Co., 320 U.S. 661, 64 S.Ct. 268, 88 L.Ed. 376 (1944), supports appellants' contention. However, the Court there was careful to point out that the counterclaim raised in the second suit was an independent claim against the plaintiff and unrelated to the matter raised in the original cause of action. Because it was a separate cause of action, the Court held that Mercoid was not bound to raise it in the earlier action and that it was not now barred. This is not our situation, and Mercoid is not authority to support appellants' contention, as the dissent suggests.
The Maryland permissive counterclaim rule does not justify the application of the Mercoid decision to our facts. That rule was never intended to apply to defenses or claims which a defendant already had a right if not a duty to raise. Rather, its purpose was to authorize the raising of claims of a defendant against a plaintiff that were unrelated to plaintiff's cause of action and which, without the rule, could not be the subject of a counterclaim. These would be independent claims or causes of action growing out of a different transaction.[7] There could be no other reason for the rule. It was aimed at inviting a consolidation of separate actions between the same parties in the interest of judicial economy.
The permissive counterclaim rule simply authorizes the filing as a counterclaim of any separate or independent claim against a plaintiff that would not have been permitted before the rule was adopted. Without the rule, separate and unrelated claims between the parties could not be resolved in one trial. That is all the rule sought to accomplish.
We agree with the trial court that the permissive counterclaim rule as no bearing on this case and that plaintiffs-appellants here should have asserted fraud as a defense to the foreclosure action.[8] The grounds asserted in the complaint here could have been a good defense to the foreclosure.[9] Having failed to raise the defense, they are now barred from raising it here as a separate cause of action.
The interests of judicial economy and, more importantly, the necessity of certainty in the finality of judgments require *487 that a defense of fraud not be withheld in a proceeding in which it would be germane, to be raised later as a separate and independent cause of action.
Accordingly, we hold that the judgment rendered in the Maryland foreclosure action bars appellants' claim here for damages at law against the sellers of the building (appellants) Snider Bros., Inc. and Snider Bros., Inc. Profit Sharing Trust, and against Oliver A. Cowan, Jr., with regard to fraud in the inducement in the sale of the property in question.
However, the claim against Cowan for misrepresentation and breach of fiduciary duty, which arose out of his handling of the partnership assets, is a separate and distinct cause of action, which was not a part of the foreclosure proceeding. We hold that the trial court's denial of Cowan's motion to dismiss, the subject of appeal No. 13876, was correct. Accordingly, the rulings of the trial court in both appeals are
Affirmed.
KELLY, Associate Judge, with whom MACK, Associate Judge, joins:
For the reasons set out in the majority division opinion, Henderson v. Snider Bros., Inc., D.C.App., 409 A.2d 1083 (1979), I dissent in No. 13271 and concur in No. 13876.
NOTES
[*]  Associate Judge Pryor recused himself from consideration of these cases on October 10, 1980.
[**]  Judge Gallagher was an Associate Judge of the court at the time the petition for rehearing was granted. His status changed to Associate Judge, Retired, on February 27, 1981.
[1]  Reference to appellants and appellees, unless otherwise noted, denotes the parties in No. 13271.
[2]  Although the trial court's decision in No. 13271 applied the doctrine of collateral estoppel rather than res judicata (direct estoppel), a decision of the trial court which is correct, even though for the wrong reasons, will be upheld. Max Holtzman, Inc. v. K&T Co., Inc., D.C.App., 375 A.2d 510, 513 (1977).
[3]  Henderson v. Snider Bros., Inc., D.C.App., 409 A.2d 1083 (1979).
[4]  Appellants allege that Snider Bros., Inc. Profit Sharing Trust is not shielded from the personal defense of fraud in the inducement as it had knowledge of the facts that gave rise to the claim, and thus cannot be considered a holder in due course.
[5]  Snider Bros., Inc. Profit Sharing Trust was later added as a necessary party.
[6]  Melaro v. Mezzanotte, 122 U.S.App.D.C. 244, 352 F.2d 720 (1965) (Maryland law governs the question of whether a plaintiff can bring a subsequent suit for damages after a decree pertaining to the same transaction in an equitable proceeding); Reiter v. Universal Marion Corp., 112 U.S.App.D.C. 68, 299 F.2d 449 (1962) (District of Columbia must give a state judgment exactly the same force and effect that it would have had in the state where it was rendered).
[7]  World Wide Imported Car Co., Ltd. v. Savings Bank of Baltimore, supra, 396 A.2d at 552.
[8]  See generally World Wide Imported Car Co., Ltd. v. Savings Bank of Baltimore, supra; cf. Klein v. Whitehead, supra.
[9]  Klein v. Whitehead, supra.
