This appeal by Chicago Investment Corporation, a party in a multi-party diversity suit, requires us to consider some knotty jurisdictional issues.
To simplify drastically the very complicated facts: A lease granted the tenant an option to buy the leased property, but provided that the option would lapse if the lease was terminated because of the tenant’s default and that any transfer by the tenant of his interest without the landlord’s prior written consent would be a default. The landlord, alleging that a default had occurred (although for other reasons), sued the tenant, who turned around and gave the Chicago Investment Corporation an irrevocable power of attorney in regard to the lawsuit and also an option (to which the landlord had not agreed) to buy the tenant’s interest.’ Pursuant to the power of attorney, Chicago Investment hired a lawyer to file a counterclaim on the tenant’s behalf. The counterclaim alleged that the lease was really a mortgage and that the tenant — the mortgagor under this theory— was the real owner of the property and should be allowed to redeem it. The landlord filed a counterclaim to the counterclaim (see Fed.R.Civ.P. 14(b)), seeking foreclosure in the event that the tenant was right about the lease actually being a mortgage. The landlord’s counterclaim named Chicago Investment as a counterdefendant, along with the tenant; apparently the landlord had gotten wind of the option that Chicago Investment had acquired from the tenant, even though the counterclaim filed by Chicago Investment on the tenant’s behalf had made no reference to Chicago Investment.
Chicago Investment responded to the landlord’s counterclaim by filing a counterclaim in its own name against the landlord, tracking the allegations in the counterclaim it had filed in the tenant’s name; and a cross-claim, under Rule 13(g) of the Federal Rules of Civil Procedure, against the tenant, seeking specific performance of the power-of-attorney and option agreements. The landlord and tenant settled their dispute before trial, leaving only the counterclaims by the landlord and Chicago Investment against each other, and Chicago Investment’s cross-claim against the tenant, pending in the court. The court granted the landlord’s motion to dismiss Chicago Investment’s counterclaim on the ground that Chicago Investment was not a real party in interest, see Fed.R.Civ.P. 17(a), and the tenant’s motion to dismiss Chicago Investment’s cross-claim on the ground that the cross-claim was not within the scope of Rule 13(g). Chicago Investment has appealed these dismissals.
The first question is whether there is a final, appealable judgment. See 28 U.S.C. § 1291. The district judge issued separate orders dismissing Chicago Investment’s counterclaim against the landlord and cross-claim against the tenant, as well as orders dismissing the landlord’s complaint and counterclaim against the tenant and the counterclaim against the landlord filed in the tenant’s name by Chicago Investment, but he issued no order disposing of the landlord’s counterclaim against Chi*581cago Investment. But as it is apparent that the landlord has abandoned that claim, we may treat the two orders that the district court did issue as together constituting a final judgment dismissing the entire lawsuit. See Bankers Trust Co. v. Mallis, 435 U.S. 381, 384, 387-88, 98 S.Ct. 1117, 1119-1122 (1978); Ced’s Inc. v. EPA, 745 F.2d 1092 at 1095-96 n. 1 (7th Cir.1984); Gracen v. Bradford Exchange, 698 F.2d 300, 302 (7th Cir.1983). The existence of formal orders distinguishes this case from C.I.T. Financial Service v. Yeomans, 710 F.2d 416 (7th Cir.1983) (per curiam), where there was nothing but a docket entry to indicate that the court had made a final disposition of the lawsuit. See id. at 417.
The next question is whether the district court was right to dismiss Chicago Investment’s cross-claim against the tenant for lack of subject-matter jurisdiction. A Rule 13(g) cross-claim does not require an independent basis of federal jurisdiction, Cenco Inc. v. Seidman & Seidman, 686 F.2d 449, 452 (7th Cir.1982), but to be within the terms of the rule the cross-claim must either arise “out of the transaction or occurrence that [was] the subject matter ... of the original action” or relate “to any property that [was] the subject matter of the original action.” We doubt whether the first criterion was satisfied here. The sense in which the cross-claim arose out of the dispute from which the original suit arose strikes us as too remote, given that the immediate source of the cross-claim was a contract made after the original suit; we should be cautious about using elastic and ill-defined notions of ancillary jurisdiction — a concept not mentioned in Article III — to expand our jurisdiction. Cf. Bernstein v. Lind-Waldock & Co., 738 F.2d 179, 188 (7th Cir.1984); By-Prod Corp. v. Armen-Berry Co., 668 F.2d 956, 960-61 (7th Cir.1982); Jackson v. Consolidated Rail Corpp., 717 F.2d 1045, 1057-58 (7th Cir. 1983) (separate opinion).
The alternative criterion for a Rule 13(g) cross-claim probably was satisfied, however; the cross-claim related to the property that was the subject-matter of the original suit. But the reasons that led the Supreme Court to state in United Mine Workers v. Gibbs, 383 U.S. 715, 726, 86 S.Ct. 1130, 1139, 16 L.Ed.2d 218 (1966), that a district judge generally should relinquish pendent jurisdiction when the main claim is dismissed before trial also compel the conclusion that he should (subject to a qualification to be noted shortly) relinquish ancillary jurisdiction when the main claim is dismissed before trial — as this and other courts have held. See In re Oil Spill of Amoco Cadiz, 699 F.2d 909, 913 (7th Cir. 1983); Waste Systems, Inc. v. Clean Land Air Water Corp., 683 F.2d 927, 930-31 (5th Cir.1982); Joiner v. Diamond M Drilling Co., 677 F.2d 1035, 1043 (5th Cir.1982); Federman v. Empire Fire & Marine Ins. Co., 597 F.2d 798, 811 (2d Cir.1979). The question whether to retain jurisdiction over a claim purely of state law involves a tradeoff between convenience to the parties and state autonomy, and the balance favors the latter interest when the main claim falls out of the case before trial. At least this is true most of the time; exceptional circumstances may warrant retention of the ancillary claim even in such a case. In Joiner, for example, the court suggested that the district court would be justified in retaining the ancillary claim, even if the main claim was dismissed before trial, if the statute of limitations would prevent the plaintiff from filing suit in state court based on the claim. 677 F.2d at 1043. But that is not a problem here. Although the statute of limitations has indeed run on the claim in Chicago Investment’s cross-claim, an Illinois law tolls the statute of limitations when a claim is dismissed by a federal district court for lack of subject-matter jurisdiction. See Ill.Rev.Stat.1981, ch. 110, ¶ 13-217. It would make no difference if we changed the basis of the dismissal from finding the claim to be outside the scope of Rule 13(g) (a dubious proposition in light of the relating-to-property clause) to requiring that ancillary jurisdiction be relinquished because the main claim was dismissed before trial; the dismissal would still be for lack of subject-matter jurisdiction, and the Illinois statute would apply.
*582But dismissal on jurisdictional grounds, it turns out, would not be the correct disposition of the cross-claim, even if federal ancillary jurisdiction is not available to support it. The claim has an independent jurisdictional basis — diversity of citizenship between the parties, and an amount in controversy greater than $10,000. See 28 U.S.C. § 1332. This is so even though, before the landlord and tenant settled, there was not complete diversity, the landlord and Chicago Investment both being Illinois corporations.
The rule is that if there are residents of the same state on both sides of a lawsuit, the suit cannot be maintained under the diversity jurisdiction even if there is also a nonresident party. See Strawbridge v. Curtiss, 7 U.S. (3 Cranch) 267, 2 L.Ed. 435 (1806). If this rule is applied here, it would follow that the complaint should have been dismissed before Chicago Investment filed its cross-claim against the tenant. Maybe, however, this should make no difference to the court’s jurisdiction over the cross-claim; maybe the cross-claim should be treated as if it had been a complaint that kicked off a brand-new suit pitting Chicago Investment against the tenant. We think this probably is right, but we also think that the requirement of complete diversity was not violated.
Like every interesting legal principle, the rule that there must be complete diversity to sustain diversity jurisdiction is not absolute. A pertinent exception is that if the nondiverse party comes into the case by intervening in it, his presence will not deprive the court of jurisdiction unless the intervenor was an indispensable party when the complaint was filed. Federal jurisdiction is determined by the facts as they exist when the case is filed, and not by what happens later, see Mollan v. Torrance, 22 U.S. (9 Wheat.) 537, 549, 6 L.Ed. 154 (1824); Smith v. Sperling, 354 U.S. 91, 93 n. 1, 77 S.Ct. 1112, 1113 n. 1, 1 L.Ed.2d 1205 (1957), as otherwise a defendant could defeat a diversity suit simply by moving to the plaintiff’s state after suit was filed. So the fact that a resident of the plaintiff’s state intervenes will not require the plaintiff to abandon his suit unless the resident was an indispensable party at the time the suit was filed — in which event the plaintiff should have joined him at the outset, and if he had done so the court would have known that complete diversity was lacking. See, e.g., Harris v. Illinois-California Express, Inc., 687 F.2d 1361, 1367-68 (10th Cir. 1982).
Although technically Chicago Investment was first made a party to this suit by the landlord, when the landlord filed a counterclaim against the tenant and named Chicago Investment as an additional defendant, it is arguable that Chicago Investment had already intervened, by filing on the basis of a transaction that it contended made it the real party in interest— the real adversary of the landlord — a counterclaim in the tenant’s name. That was the filing that provoked the landlord to name Chicago Investment as an additional counterdefendant. Chicago Investment’s failure to file a formal motion for leave to intervene before it filed the counterclaim in the tenant’s name would not necessarily be fatal to its status as an intervenor. See, e.g., Montgomery v. Rumsfeld, 572 F.2d 250, 255 (9th Cir.1978); 7A Wright, Miller & Kane, Federal Practice and Procedure § 1914 (1983 Pocket Part). But a more serious problem is that the counterclaim did not disclose Chicago Investment’s interest, or even its existence; and an invisible intervenor would be a genuine legal novelty. However, after the landlord filed its counterclaim against the tenant and Chicago Investment, Chicago Investment did move for leave to intervene, and the court granted its motion (though not in so many words) by formally authorizing Chicago Investment to file pleadings and participate as a party in the litigation. Although the motion came after Chicago Investment filed its first counterclaim, maybe that filing was the real, as distinct from the formal, commencement of Chicago Investment’s participation in the lawsuit; maybe its intervention can be backdated to then. We shall see that this is not a critical step *583to take, however, though it will be convenient for the time being to assume that Chicago Investment was in fact an intervenor from the time it first filed a counterclaim on the tenant’s behalf.
What is critical, and at the same time indubitable, is that Chicago Investment was not an indispensable party when the landlord filed its complaint against the tenant. Chicago Investment had no interest in the property then; its interest arose from the contract that it signed with the tenant after the landlord sued the tenant. It is as if the tenant had sold his rights to a resident of Illinois, who had then moved to be substituted as plaintiff (see Fed.R.Civ.P. 25(c)); in that ease, provided that the sale came after the landlord sued the tenant, diversity jurisdiction would be unaffected. See 13 Wright, Miller & Cooper, Federal Practice and Procedure § 3608 (1975). This indeed is Chicago Investment’s characterization of its transaction with the tenant: it views itself as his successor in interest.
Even if, therefore, the presence of Chicago Investment, a resident of Illinois, on the opposite side of the case from the landlord, also an Illinois resident, did not in and of itself destroy the complete diversity on which the district court’s jurisdiction over the lawsuit depended, it might seem that the landlord’s naming of Chicago Investment as an additional defendant in the counterclaim the landlord filed against the tenant destroyed complete diversity under the principle of Owen Equipment & Erection Co. v. Kroger, 437 U.S. 365, 98 S.Ct. 2396, 57 L.Ed.2d 274 (1978). In that case a plaintiff filed a diversity suit against one of several alleged joint tortfeasors. At this stage that was complete diversity. But the defendant impleaded another of the joint tortfeasors, who happened to be a resident of the plaintiff’s state, and the plaintiff then filed a third-party claim against this new party — with the result, the Supreme Court held, of eliminating diversity jurisdiction over the entire action. But it seems that the basis of this result is that the plaintiff was doing in two steps what, if she had done it in one, would have clearly disclosed the absence of federal jurisdiction; for she could easily have joined the resident tortfeasor as a defendant in her original complaint, see 437 U.S. at 374, 98 S.Ct. at 2403, and then the federal'court would have had no jurisdiction. That was not a possibility here. When the landlord brought its suit against the tenant, Chicago Investment claimed no interest in the subject matter of the suit; its claim arose later, when it signed a contract with the tenant. Thus this case is controlled by the competing principle that jurisdiction, once it attaches, is not defeated by later events; and consequently the filing by Chicago Investment of its cross-claim cannot be thought a void act because done in a suit over which the court had no (diversity) jurisdiction.
As for the basis of federal jurisdiction over Chicago Investment’s counterclaim against the landlord (a resident of the same state), a claim also involved in this appeal, we begin by noting that the landlord’s counterclaim against Chicago Investment would have required — under conventional principles anyway — an independent jurisdictional basis if Chicago Investment was merely a permissive intervenor (Fed.R.Civ.P. 24(b)). See 7A Wright & Miller, Federal Practice and Procedure § 1917, at pp. 592-95 (1972). But Chicago Investment was an intervenor of right — if it was any sort of intervenor — because it “claim[ed] an interest relating to the property or transaction which is the subject of the action,” and was “so situated that the disposition of the action may as a practical matter impair or impede his ability to protect that interest,” and because its interests were not adequately protected by any other parties (it was an adversary of all the other parties). Fed.R.Civ.P. 24(a)(2). Therefore, the landlord's claim against it was within the ancillary jurisdiction of the federal court, see 7A Wright & Miller, supra, § 1917, at pp. 597-605, and Chicago Investment’s counterclaim to that counterclaim, being compulsory (see Fed.R.Civ.P. 13(a)), was within that jurisdiction too.
*584This analysis suggests, however, that it was merely helpful, and not essential, to contort the language of Rule 24 in our earlier jurisdictional analysis of the cross-claim to make Chicago Investment’s initial entry into the lawsuit a formal intervention. If Chicago Investment was an intervenor, then the landlord was authorized by Rule 14(b) of the Federal Rules of Civil Procedure to file a counterclaim against it; and (as we have seen), provided that Chicago Investment was an intervenor of right, the counterclaim was within the federal ancillary jurisdiction and did not destroy the complete diversity required to maintain the lawsuit in federal court. If, however, Chicago Investment was not an intervenor, the landlord’s claim against it could be characterized in two (really three) ways. One is as the complaint in an independent action over which the court had no jurisdiction because the parties were not of diverse citizenship. On this view the claim would have to be dismissed, but dismissal would not affect the court’s jurisdiction over the underlying action between the landlord and tenant, which was the action in which Chicago Investment’s cross-claim was filed. The other possible characterization is as either a Rule 15(a) amendment to the landlord’s complaint to add another defendant or a Rule 21 addition of a party. See 6 Wright & Miller, Federal Practice and Procedure § 1479, at pp. 400-02 (1971). If the new defendant (Chicago Investment) could have been joined originally, then the amendment or addition (implicitly authorized by the district court) would, under Kroger, require dismissal of the entire action. But since this particular defendant could not have been joined originally, bringing him into the lawsuit did not destroy complete diversity. The landlord’s claim against him was a legitimate ancillary claim; the Court in Kroger had observed that the earliest invocation of ancillary jurisdiction was to permit rival claimants to property involved in a federal suit to participate in the suit without regard to their citizenship. See 437 U.S. at 375 n. 18, 98 S.Ct. at 2403 n. 18; Freeman v. Howe, 65 U.S. (24 How.) 450, 460, 16 L.Ed. 749 (1861).
Of course the fact that the district court retained its diversity jurisdiction over the landlord’s dispute with the tenant notwithstanding the injection into the suit of another resident (Chicago Investment) of the landlord’s state on the tenant’s side of the case does not establish federal jurisdiction over Chicago Investment’s cross-claim against the tenant; it merely eliminates an obstacle to that jurisdiction. If the landlord were the nonresident, and the tenant and Chicago Investment were the co-residents, the cross-claim could be maintained if at all only under the ancillary jurisdiction of the federal court. And it is doubtful, as we have seen, that it could be: not because Rule 13(g) is inapplicable — probably it is applicable, because the cross-claim relates to the property that was the subject matter of the original action — but because ancillary jurisdiction should have been relinquished when the main claim was dismissed before trial.
The significance of our discussion of complete diversity lies rather in the fact that if the intervention of Chicago Investment had eliminated the federal court’s jurisdiction over the original lawsuit, we might have to order the cross-claim, which was filed later, dismissed because filed in a proceeding over which the district court had no jurisdiction, even though the cross-claim could have been filed as an independent diversity action. We say “might” rather than “would” for two reasons. First, as mentioned earlier, since the cross-claim would have successfully invoked the court’s diversity jurisdiction if captioned a complaint, it seems a pointless formality, quite contrary to the spirit of the Federal Rules of Civil Procedure (see, e.g., the second sentence of Rule 1), to require the cross-claim to be refiled as a complaint; and it would be a hurtful formality as well, where (as here) the statute of limitations has run in the meantime, but for the Illinois tolling statute that we cited earlier and that appears to be applicable to cases where the second suit is refiled in federal *585court, as well as where it is filed in state court. See, e.g., Perkins v. Hendrickson Mfg. Co., 610 F.2d 469 (7th Cir.1979). Second, there is authority for retaining diversity jurisdiction over a ease when the parties whose presence deprived (one might have thought) the court of diversity jurisdiction are dropped from the case. See, e.g., Publicker Industries, Inc. v. Roman Ceramics Corp., 603 F.2d 1065, 1068-69 (3d Cir.1979); Ross v. International Brotherhood of Electrical Workers, 634 F.2d 453, 456-57 (9th Cir.1980). These cases raise theoretical problems — for how can jurisdiction be conferred retroactively? — that we have touched on elsewhere, see Denberg v. Railroad Retirement Bd., 696 F.2d 1193, 1197 (7th Cir.1983); Illinois v. General Electric Co., 683 F.2d 206, 209 (7th Cir.1982), but that we need not worry about here since we hold that the district court never lost the diversity jurisdiction that the landlord invoked by its original complaint, and therefore under no one’s view must the cross-claim be refiled as an independent action.
All this is not to say that Chicago Investment’s cross-claim has any merit. But we think it should not have been dismissed at the threshold, on subject-matter jurisdiction grounds. As for whether Chicago Investment’s counterclaim against the landlord was properly dismissed under Rule 17(a), the lease by its terms lapsed when the tenant, without the landlord’s prior written authorization, granted Chicago Investment an option to acquire the tenant’s interest — or, at the very least, would have lapsed if Chicago Investment had attempted to exercise the option. So Chicago Investment did not and could not acquire an interest in the subject matter of the lawsuit between the landlord and the tenant. Its argument that the clause forbidding transfers is void because the lease is really a mortgage comes too late when made for the first time on appeal. Although it did argue in the district court that the lease was really a mortgage, it did not do so as a step in seeking to invalidate the no-transfer clause and thus defeat the landlord’s invocation of Rule 17(a). It did not challenge that clause below, and cannot do so for the first time on appeal. And if the clause is valid, Chicago Investment is not a real party in interest.
Our conclusion that Chicago Investment’s counterclaim against the landlord was rightly dismissed under Rule 17(a) may seem inconsistent with our earlier discussion of Chicago Investment’s possible status as an intervenor, a status based on its claim to have been the real party in interest as a result of the tenant’s giving it an option to buy the tenant’s interest in the property. There is no inconsistency. Rule 24(a)(2) requires only that the applicant claim an interest relating to the property in suit. The fact that his claim ultimately fails does not affect his status at the time when he first appeared in the suit.
The order dismissing Chicago Investment’s counterclaim is affirmed; the order dismissing its cross-claim is reversed and the matter remanded for further proceedings consistent with this opinion. No costs in this court.