
647 F.Supp. 1394 (1986)
Robert C. SPRINGS, Plaintiff,
v.
FIRST NATIONAL BANK OF CUT BANK, a national banking association, Defendant.
No. CV-86-141-GF.
United States District Court, D. Montana, Great Falls Division.
November 14, 1986.
Ross W. Cannon, Edmund F. Sheehy, Jr., Cannon & Sheehy, Helena, Mont., for plaintiff.
*1395 Richard A. Shors, Peterson, Peterson, Burns & Shors, Cut Bank, Mont., for defendant.

MEMORANDUM AND ORDER
HATFIELD, District Judge.
Plaintiff Robert Springs instituted the present action to recover damages emanating from the defendant First National Bank of Cut Bank's ("the Bank") alleged breach of the covenant of "good faith and fair dealing" purportedly attendant certain loan agreements extant between Springs and the Bank. The matter is presently before the court on the Bank's motion requesting the court to dismiss the complaint pursuant to Rule 12(b)(6) of the Federal Rules of Civil Procedure. The Bank contends plaintiff's claims are barred because they were compulsory counterclaims which should have been plead in a prior action. The parties agree that defendant's motion should be treated as a motion for summary judgment under Rule 56, Fed.R.Civ.P. The court has jurisdiction of this matter pursuant to 28 U.S.C. § 1332.

FACTS
The present dispute began in 1981, when the plaintiff purchased a home in Cut Bank, Montana. To finance that purchase, plaintiff received loans from the Bank and Charles and Gladys Billman ("the Billmans"), who were the owners of the home. In return for the loans, plaintiff gave the Bank a trust indenture and executed a mortgage note to the Billmans. The Bank's trust indenture was given first priority.
The Billmans' mortgage was drafted to expire after three years, at which time the Bank agreed to pay the Billmans in full on plaintiff's behalf. The Bank would then refinance the home and the money the Bank paid to the Billmans would be added to plaintiff's loan.
In 1982, the Internal Revenue Service ("IRS") attached a tax lien to plaintiff's home. The tax lien had a lower priority than the Bank's trust indenture and the Billmans' mortgage note.
In 1983, plaintiff went bankrupt and his personal liability to the Bank, the Billmans, and the IRS was discharged. However, each party retained their security interest in the Cut Bank home.
In 1984, the Billmans' mortgage note came due. The Bank was contractually obligated to pay the Billmans and refinance the home. Therefore, the Bank had plaintiff execute a new trust indenture which revived plaintiff's personal liability to the Bank and had a lower priority on the home than the IRS tax lien. When the refinancing occurred, the Bank was unaware of the IRS tax lien.
In 1985, plaintiff stopped making payments on the home and the Bank filed a foreclosure action in Montana state district court. The Bank took a default judgment when plaintiff failed to appear or plead. However, the IRS appeared in the action and asserted its tax lien. The Bank and the IRS stipulated that the Bank's first trust indenture had top priority, followed by the tax lien and then the Bank's second trust indenture.
Thereafter, the Bank purchased the property at a sheriff's sale for the outstanding balance on the first trust indenture plus post-judgment interest and the costs of the sale. The Bank took a deficiency judgment and has pursued collection efforts against the plaintiff, who now resides in Colorado.
On July 2, 1986, plaintiff instituted the present action. Plaintiff alleges the Bank was negligent in allowing the tax lien to take priority over the second trust indenture and, furthermore, that the Bank acted in bad faith by requiring him to refinance his debt with the Billmans.
The Bank asserts plaintiff's claims are barred because they should have been brought as compulsory counterclaims in the Bank's prior foreclosure action. Therefore, the Bank has moved to dismiss plaintiff's complaint pursuant to Rule 12(b)(6), Fed.R.Civ.P.

DISCUSSION
The issue before the court is whether the plaintiff's claims were compulsory counterclaims. *1396 In that regard, the United States Supreme Court has held that state law governs whether a state court judgment bars a subsequent federal diversity action. Angel v. Bullington, 330 U.S. 183, 192, 67 S.Ct. 657, 662, 91 L.Ed. 832 (1947). Therefore, in the instant case, this court must apply Montana law to determine whether plaintiff's claims are barred because they were compulsory counterclaims which should have been brought in the earlier state court action.
Rule 13(a) of Montana's Rules of Civil Procedure states in part:
(a) Compulsory Counterclaims. A pleading shall state as a counterclaim any claim which at the time of serving the pleading the pleader has against any opposing party, if it arises out of the transaction or occurrence that is the subject matter of the opposing party's claim.... (emphasis added).
The purpose of the compulsory counterclaim rule is to insure that only one judicial proceeding be required to settle all those matters determinable by the facts or law, thereby avoiding a multiplicity of suits. Julian v. Mattson, ___ Mont. ___, 710 P.2d 707, 709, 42 St.Rptr. 1908, 1910-11 (1985); citing 20 Am.Jur.2d Counterclaim, Recoupment, Etc., § 15.
Rule 13(a) bars a party who failed to assert a compulsory counterclaim in one action from instituting a second action in which that counterclaim is the basis of the complaint. Seattle Totems Hockey Club, Inc. v. National Hockey League, 652 F.2d 852, 854 (9th Cir.1981); citing Southern Construction Co. v. Pickard, 371 U.S. 57, 60, 83 S.Ct. 108, 110, 9 L.Ed.2d 31 (1962); Wright & Miller, Federal Practice & Procedure, Civil §§ 1417-1418 (1971). "It is well-settled that in order to enforce this bar, a federal court may enjoin a party from bringing its compulsory counterclaim in a subsequent federal court action." Id.
In Julian v. Mattson, ___ Mont. ___, 710 P.2d 707, 42 St.Rptr. 1908 (1985), the Montana Supreme Court applied Rule 13(a) to a dispute involving the construction of a home. In that case, a builder successfully sued a homeowner to collect the balance due for construction of the home. The homeowner then sued the builder in a separate action, claiming defects in construction. The district court dismissed the homeowner's claim, on the grounds it was an omitted compulsory counterclaim. In upholding the district court's decision, the Montana Supreme Court stated that the purpose of the compulsory counterclaim rule is to bring all logically related claims into a single litigation. 710 P.2d at 708.
The logical relationship test, which has been adopted by several federal circuit courts of appeal in construing Rule 13(a), Fed.R.Civ.P., inquires, "Is there any logical relation between the claim and the counterclaim"? McCabe v. United Bank of Boulder, 657 P.2d 976, 978 (Colo.App.1982). A logical relationship exists when the counterclaim arises from the same "aggregate of operative facts" as the opposing party's claim. Id.
In the instant case, the court is compelled to conclude that plaintiff's claims and the Bank's foreclosure action arose from the same "aggregate of operative facts" or transaction. The Montana Supreme Court has defined "transaction" as:
... that combination of acts and events, circumstances and defaults, which, viewed in one aspect, results in the plaintiff's right of action, and viewed in another aspect, results in the defendant's right of action (cite omitted), and it applies to any dealings of the parties resulting in wrong, without regard to whether the wrong be done by violence, neglect or breach of contract.
Julian v. Mattson, 710 P.2d at 710, 42 St.Rptr. at 1911; citing Scott v. Waggoner, 48 Mont. 536, 545, 139 P. 454, 456 (1914).
The court finds that the transaction in the instant case was the financing of plaintiff's home. Plaintiff's theories of liability all rest upon the Bank's purported acts of wrongdoing prior to the time it filed the foreclosure action, specifically its negligence, *1397 or bad faith conduct, while financing plaintiff's purchase of the home. Therefore, a logical relationship exists between plaintiff's claims and the Bank's actions in foreclosing on plaintiff's home.
The plaintiff counters the Bank's contention by asserting that his claims had not matured at the time the foreclosure action was filed. Plaintiff submits that his cause of action depended entirely upon the outcome of the Bank's foreclosure proceeding and, therefore, was not part of the same transaction as required by Rule 13(a) of the Mont.R.Civ.P. The court finds this argument unpersuasive.
"A counterclaim is not barred because recovery will depend on the outcome of the main action." Interphoto Corporation v. Minolta Corporation, 47 F.R.D. 341, 344 (1969). The Interphoto rationale was cited with approval by Wright and Miller in their treatise on Federal Practice and Procedure, Civil § 1411, n. 3:
One court has stated that a counterclaim will not be denied treatment as a counterclaim solely because recovery on it depends on the outcome of the main action. This approach seems sound when the counterclaim is based on pre-action events and only the right to relief depends on the outcome of the main action. (emphasis added).
As discussed above, the court recognizes that the plaintiff's theories of liability were based on the Bank's alleged acts of negligence and bad faith conduct prior to instituting the foreclosure action. Therefore, the court finds that plaintiff's claims were compulsory counterclaims within the meaning of Rule 13(a). Having failed to raise those claims in the Bank's foreclosure action, the plaintiff is barred from asserting them in this action.
For the reasons discussed herein,
IT IS HEREBY ORDERED that defendant's motion to dismiss be, and the same hereby is, GRANTED, and summary judgment is entered for the defendant.
