The Shinnecock Indian Nation and its tribal officials (collectively, the “Shinnecock” or the “Tribe”) appeal from a judgment of the United States District Court for the Eastern District of New York (Joseph F. Bianco, Judge). After a bench trial, the district court granted a permanent injunction prohibiting the Tribe from developing a casino on a plot of land known as Westwoods without complying with the laws of New York State and the Town of Southampton. The Shinnecock object to a number of the district court’s factual and legal conclusions, including its findings: (1) that tribal sovereign immunity from suit does not bar this action; (2) that the Shinnecock’s aboriginal title to the land at Westwoods was extinguished in the seventeenth century; (3) that even if aboriginal title had not' been extinguished, equitable principles would prevent the Shinnecock’s development of a casino in violation of state and local law; and (4) that the federal Indian Gaming Regulatory Act (“IGRA”) supplanted any federal common law right the Tribe may have had to operate the casino. They also argue that the Bureau of Indian Affairs’s recent recognition of the Shinnecock Indian Nation moots the injunction.
We conclude that the district court lacked subject matter jurisdiction over this action, and thus do not reach the merits of this appeal.
BACKGROUND
In 2003, the Shinnecock entered into a contract for the construction of a 61,000-square-foot casino on 80 acres of land it owned, known as Westwoods, in the town of Southampton, New York. The Tribe did not obtain permits from the State of New York or the Town of Southampton. In July 2003, the Shinnecock began bulldozing trees and brush to begin construction.
On or about June 29, 2003, the State of New York, the New York State Racing *136and Wagering Board, and the New York State Department Of Environmental Conservation (collectively, “the State”) sued the Tribe in New York State Supreme Court, seeking to prevent it from going forward with the casino without complying with state law. The State asserted five claims. The first alleges that the planned casino violates state law, and is outside the scope of the IGRA — a federal act that authorizes tribal gaming under certain conditions — because the Tribe is not federally recognized and Westwoods is not “Indian lands.” The remaining claims allege that construction of the casino would violate state environmental laws because the Tribe did not obtain required permits or conduct a required environmental review.1 The State sought an injunction preventing the Tribe from constructing and operating a gaming facility at Westwoods. It also sought a declaration that, among other things, the Tribe may not pursue gambling activities at the site until it complies with state law or the IGRA.
The Shinnecock removed the case to federal court on the basis that the State’s complaint pleaded issues of federal law. The removal notice identified four “conclusions about federal law” alleged in the complaint, all of which relate to the complaint’s assertion that federal law does not authorize the Shinnecock to construct a casino at Westwoods in violation of state and local law. In its answer to the complaint, the Tribe admitted that it had not obtained any permit from the State of New York or the Town of Southampton. It asserted, however, that on the basis of federal Indian law, neither the State nor the Town has the power to regulate activities at Westwoods because the Tribe has aboriginal title to the land.
The State moved to remand the action to state court, disputing the presence of a federal question on the face of its complaint. It argued that its complaint is based entirely on violations of New York state law, that the Shinnecock’s removal is based on the complaint’s anticipation of the Shinnecock’s defenses, and that the complaint’s reference to the IGRA asserts only that the IGRA does not apply, whereas only state law does.
Judge Platt, to whom this case was initially assigned, denied the State’s motion. He found that the State’s complaint asserts a violation of the IGRA and raises federal questions about the possessory rights of Indian tribes. New York v. Shinnecock Indian Nation, 274 F.Supp.2d 268 (E.D.N.Y.2003).
*137Shortly before Judge Platt’s decision on the remand motion, the Town of Southampton (the “Town”) filed a separate suit alleging that the Shinnecock’s construction of a casino would violate the Town’s zoning, land use, and wetlands protection ordinances, and seeking injunctive and declaratory relief.2 The Shinnecock removed the Town’s action to federal court. The Town moved to remand, but the district court suspended decision on the motion and the Town eventually withdrew it when the district court consolidated the Town’s suit with the State’s.
After additional rounds of motion practice, the district court conducted a bench trial.3 The parties introduced evidence of the history of the Shinnecock and their aboriginal title to the land at Westwoods, and of the casino’s potential impact on neighboring landowners and the Town of Southampton.
At the close of trial, the district court ruled in favor of the State and the Town and granted a permanent injunction prohibiting the Shinnecock from building a casino on Westwoods without complying with state and local law. New York v. Shinnecock Indian Nation, 523 F.Supp.2d 185 (E.D.N.Y.2007); see also New York v. Shinnecock Indian Nation, 560 F.Supp.2d 186 (E.D.N.Y.2008) (modifying injunction). The district court found (1) that tribal sovereign immunity from suit does not bar this action; (2) that the Shinnecock’s aboriginal title to the land at Westwoods was extinguished in the seventeenth century; (3) that even if the Shinnecock had unextinguished aboriginal title, equitable considerations would, under City of Sherrill v. Oneida Indian Nation, 544 U.S. 197, 125 S.Ct. 1478, 161 L.Ed.2d 386 (2005), bar their development of a casino at West-woods because of the disruption it would cause to the Town and the long-standing expectations of its residents; and (4) that the IGRA, which did not apply to the Shinnecock because they were not a federally-recognized tribe, supplanted any federal common law right Indian tribes might have had to operate casinos. See Shinnecock Indian Nation, 523 F.Supp.2d at 249-302.
The Shinnecock appealed. They challenge the district court’s legal and factual conclusions and argue that the federal government’s recent recognition of the Tribe has mooted the injunction.
DISCUSSION
Before we can address the merits of the Shinnecock’s appeal, we must determine whether the district court had subject matter jurisdiction over the case. In re Methyl Tertiary Butyl Ether (“MTBE”) Prods. Liab. Litig., 488 F.3d 112, 121 (2d Cir.2007). Although the plaintiffs argued below that federal jurisdiction was absent, on appeal all parties take the *138position that subject matter jurisdiction exists based on the federal questions the case raises. Nevertheless, we must conduct an independent inquiry. Jurisdiction cannot be created by the consent of the parties. See Steel Co. v. Citizens for a Better Env’t, 523 U.S. 83, 95, 118 S.Ct. 1003, 140 L.Ed.2d 210 (1998) (“[E]very federal appellate court has a special obligation to satisfy itself not only of its own jurisdiction, but also that of the lower courts in a cause under review, even though the parties are prepared to concede it.” (internal quotation marks omitted)); City of New York v. Mickalis Pawn Shop, LLC, 645 F.3d 114, 125-26 (2d Cir.2011).
I. The Well-Pleaded Complaint Rule
Under 28 U.S.C. § 1331, federal district courts have jurisdiction over cases “arising under the Constitution, laws, or treaties of the United States.” A cause of action arises under federal law only when the plaintiffs “well-pleaded complaint” raises an issue of federal law. Metro. Life Ins. Co. v. Taylor, 481 U.S. 58, 63, 107 S.Ct. 1542, 95 L.Ed.2d 55 (1987). “The ‘well-pleaded complaint rule’ is the basic principle marking the boundaries of the federal question jurisdiction of the federal district courts.” Id. (quoting Franchise Tax Bd. v. Constr. Laborers Vacation Trust, 463 U.S. 1, 9-12, 103 S.Ct. 2841, 77 L.Ed.2d 420 (1983)).
A cause of action raises an issue of federal law only when “a right or immunity created by the Constitution or laws of the United States ... [is an] essential [element] of the ... cause of action.” Gully v. First Nat’l Bank, 299 U.S. 109, 112, 57 S.Ct. 96, 81 L.Ed. 70 (1936). It is not enough that the complaint anticipates a potential federal defense. Caterpillar Inc. v. Williams, 482 U.S. 386, 393, 107 S.Ct. 2425, 96 L.Ed.2d 318 (1987); Franchise Tax Bd., 463 U.S. at 12, 103 S.Ct. 2841; Gully, 299 U.S. at 116, 57 S.Ct. 96; Taylor v. Anderson, 234 U.S. 74, 75-76, 34 S.Ct. 724, 58 L.Ed. 1218 (1914). And this is true even if the parties concede that the defense is the only disputed issue in the case. Caterpillar Inc., 482 U.S. at 393, 107 S.Ct. 2425; Franchise Tax Bd., 463 U.S. at 12, 103 S.Ct. 2841. Moreover, a declaratory judgment claim that raises an issue of federal law does not give rise to federal question jurisdiction if, “but for the availability of the declaratory judgment procedure, the federal claim would arise only as a defense to a state created action.” Franchise Tax Bd., 463 U.S. at 16, 103 S.Ct. 2841.
In this case, the State and Town allege only violations of state and local law. The State alleges that the Tribe’s construction of the casino would violate state gaming and environmental laws and the Town alleges that it would violate local zoning and wetlands protection ordinances. Although the State’s complaint refers to federal law, these references assert only that federal law does not immunize the Shinnecock’s conduct and thus cannot provide a defense against the Tribe’s violation of state and local law. For example, the State’s complaint alleges that:
74. Because federal recognition of a tribe of Indians is a condition precedent under [the] IGRA for any tribe of Indians in New York State to conduct certain gaming activities which would otherwise be in violation of State law, and because the United States has not granted such recognition to the [Tribe], it and its officials are subject to and must comply with the State gaming laws in order to conduct such gaming.... 76. ... [B]ecause the site of the planned casino is not “Indian Country” as defined in federal law and in [the] IGRA, the Cabazon decision[, which arguably supports the Shinnecock’s right *139under federal law to construct the casino free from local regulation,] has no application at all.
Because the complaint’s references to federal law only anticipate and refute the Shinnecock’s defenses, they do not give rise to federal question jurisdiction. As Justice Cardozo explained in Gully, a complaint “will not avail as a basis of jurisdiction in so far as it goes beyond a statement of the plaintiffs cause of action and anticipates or replies to a probable defense.” 299 U.S. at 113, 57 S.Ct. 96; see also Oklahoma Tax Comm’n v. Graham, 489 U.S. 838, 841, 109 S.Ct. 1519, 103 L.Ed.2d 924 (1989) (noting that although “[t]ribal immunity may provide a federal defense to [the plaintiffs] claims[,] ... it has long been settled that the existence of a federal immunity to the claims asserted does not convert a suit otherwise arising under state law into one which, in the statutory sense, arises under federal law”).
II. Substantial Federal Question Exception
The State and Town argue that their complaints give rise to federal question jurisdiction whether or not the complaints assert a federal cause of action because their right to relief depends on the resolution of substantial questions of federal law. To prevail on their claims that the Shinnecock’s construction of a casino would violate state and local law, the State and Town must establish, among other things, that federal Indian law does not preclude the application of state and local law to the Tribe’s activities at Westwoods. Indeed, this was essentially the only issue in dispute at trial. The State and Town argue that the presence of this issue in the case is sufficient to establish federal question jurisdiction. - ■
In arguing that the federal law issues on which their right to relief depends give rise to federal question jurisdiction, the State and Town rely on Grable & Sons Metal Prods., Inc. v. Darue Eng’g & Mfg., 545 U.S. 308, 125 S.Ct. 2363, 162 L.Ed.2d 257 (2005). In Grable, the Supreme Court acknowledged that “in certain cases federal-question jurisdiction will lie over state-law claims that implicate significant federal issues.” Id. at 312, 125 S.Ct. 2363. The case involved a state law action Grable had brought asserting superior title to certain real property the IRS had seized to satisfy Grable’s federal tax delinquency. Id. at 311, 125 S.Ct. 2363. After the IRS seized the property, it notified Grable, waited until the 180-day statutory redemption period expired, and sold the property to Darue. Id. at 310-11, 125 S.Ct. 2363. Grable sued Darue, claiming that Darue’s title to the property was invalid because the IRS had failed to notify Grable of the seizure in the manner federal law requires. Id. at 311, 125 S.Ct. 2363. Darue removed the case to federal court on the basis that Grable’s state law quiet title claim depended on the interpretation of federal tax law’s notice requirement. Id. Grable moved to remand the case to state court but the district court denied the motion and ruled in favor of Darue on the merits. Id. The court of appeals affirmed, and the Supreme Court granted. certiorari on the jurisdictional issue. Id.
The Supreme Court held that federal question jurisdiction was present because Grable’s state law claim “necessarily raise[d] a stated federal issue, actually disputed and substantial, which a federal forum may entertain without disturbing any congressionally approved balance of federal and state judicial responsibilities.” Id. at 314, 125 S.Ct. 2363. First, the Court explained that state law required Grable to “specify” in its complaint “ ‘the facts establishing the superiority of [its] claim.’ ” Id. (quoting Mich. Ct. Rule 3.411(B)(2)(c) (West 2005)). Because Grable premised *140its quiet title claim on the IRS’s failure to give it adequate notice, whether the notice complied with the federal statute was an essential element of its claim. Id. at 315, 125 S.Ct. 2363. The Court went. on to conclude that the meaning of the federal tax provision was actually disputed and was an important issue of federal law, and that federal jurisdiction over the case would not disturb “the federal-state division of labor.” Id. The exercise of federal question jurisdiction over Grable’s action was thus appropriate.
Unlike Grable’s quiet title claim, the claims that the State and Town assert in this case do not “necessarily raise a ... federal issue.” Id. at 314, 125 S.Ct. 2363. The question whether the Shinnecock’s construction of the casino would violate state and local law is distinct from the questions whether sovereign immunity from suit under federal law bars these actions and whether federal law precludes the State and Town from regulating the Shinnecoek’s activities at Westwoods.4 For example, if the Shinnecock were to have established that their construction of the casino complied with state and local law, the court could have resolved the case without reaching the federal issues.5 Be*141cause the claims do not necessarily raise a federal issue, the substantial federal question exception to the well-pleaded complaint rule does not apply.6
III. Possessory Land Claims by Indian Tribes
Finally, the Shinnecock argue that federal question jurisdiction over this case can be premised on an extension of the Supreme Court’s decision in Oneida Indian Nation v. County of Oneida, 414 U.S. 661, 94 S.Ct. 772, 39 L.Ed.2d 73 (1974). Oneida Indian Nation involved the Indian tribe’s suit for damages based on the County’s wrongful possession of tribal land. Id. at 663-65, 94 S.Ct. 772. The Court held that the case gave rise to federal question jurisdiction because the Indian tribe’s “complaint asserted a current right to possession conferred by federal law, wholly independent of state law.” Id. at 666, 94 S.Ct. 772.
The Court took care, however, to note that its decision did not “disturb the well-pleaded complaint rule.” Id. at 676, 94 S.Ct. 772. It explained that “this is not a case where the underlying right or obligation arises only under state law and federal law is merely alleged as a barrier to its effectuation.” Id. at 675, 94 S.Ct. 772. Rather, “the right to possession itself is claimed to arise under federal law in the first instance.” Id. at 676, 94 S.Ct. 772. To clarify this point further, Justice Rehnquist wrote a concurring opinion “emphasizfing] that the majority opinion does not disturb the long line of this Court’s cases narrowly applying ... the well-pleaded complaint rule.” Id. at 683, 94 S.Ct. 772. Underscoring the majority opinion’s conclusion, he stated that “this is not a case which depends for its federal character solely on possible federal defenses or on expected responses to possible defenses.” Id. at 682-83, 94 S.Ct. 772.
The case before us, in contrast, does “depend[ ] for its federal character solely” on the federal defenses at issue. Because the Oneida Indian Nation decision carefully distinguished that case from one in which federal issues related to Indian land arise defensively, it does not support finding federal question jurisdiction in this case.7
*142Accordingly, we conclude that federal subject matter jurisdiction over this action is absent.
CONCLUSION
For the foregoing reasons, we VACATE the judgment of the district court and REMAND with instructions for the district court to remand the case to New York state court.
. Specifically, the second claim alleges that the Shinnecock failed to "prepare a Stormwater Pollution Prevention Plan and file a Notice of Intent pursuant to the [New York State Department of Environmental Conservation's ("DEC”) ] General [State Pollutant Discharge Elimination System ("SPDES”) ] Permit for Construction,” and thus "have no right to commence construction of a casino” at West-woods. The third claim alleges that the Shinnecock failed "to obtain a[n] SPDES permit pursuant to [New York Environmental Conservation Law ("ECL”)] § 17-0803,” and, therefore, "have no right to commence construction of a casino [at Westwoods] with a wastewater treatment facility that will discharge effluent to the waters of the State.” The fourth claim alleges that the Shinnecock failed "to obtain a permit pursuant to ECL § 15-1527,” and thus "have no right to commence construction of a casino [at West-woods] with a new well with an installed pumping capacity in excess of forty-five gallons per minute.” The fifth and final claim alleges that the Shinnecock "failed to conduct assessments or studies necessary for DEC's compliance with [the New York State Environmental Quality Review Act] ..., or to provide DEC with funds sufficient to allow DEC to conduct such assessments or studies,” and, as a result, “DEC may not issue permits that would allow the construction and operation of a casino” at Westwoods.
. Specifically, the Town's first claim alleges that the Shinnecock failed to apply for or receive "site plan approval with respect to [Westwoods] for any purpose whatsoever,” and to apply for or receive "permission from the Town Planning Board to engage in” site preparation activities, "including but not limited to, the clearing of land, removal of trees, grading, regrading, bulldozing, and/or excavating at [Westwoods] (the 'Site Preparation Activities'),” and that the Shinnecock's "conduct of some or all of the Site Preparation Activities” thus violates "Section 330-184, subd. I” of the Code of the Town of Southampton, New York (the "Town Code”). The Town's second and final claim alleges that the Shinnecock failed to apply for or obtain a permit required by "Section 325-6, subd. A. of the Town Code” — which regulates activities permissible on land, such as Westwoods, that is designated as a wetlands area — and that the Tribe thus may not conduct Site Preparation Activities at Westwoods.
. On the sixth day of trial the case was reassigned from Judge Platt to Judge Bianco.
. The dissent agrees that the issues in this case regarding the Tribe’s defense of sovereign immunity from suit, conferred on the Tribe by federal law, do not give rise to federal question jurisdiction. Dissent at 143. However, the dissent posits an additional, "antecedent” issue: "the plaintiffs, in order to establish that it has any authority over the tribe's activities at issue, must prove that Westwoods is not Indian land." Id. It is this issue, according to the dissent, that gives rise to federal question jurisdiction. Id. at 143-46.
We fail to perceive a difference between the plaintiffs' right to bring an action enforcing state and local law at Westwoods, and the Tribe’s sovereign immunity from suit and local regulation of activities at Westwoods. It appears to us that the question whether plaintiffs can bring this action is simply a restatement of the question whether the Tribe is immune from suit and from state and local regulation. The dissent does not appear to point to any other factor that would bar plaintiffs from bringing suit to enforce the application of state and local regulation to activities at Westwoods. Moreover, even if the issue the dissent posits could coherently be distinguished, it still comes into the case as a defense, because — contrary to the dissent's ipse dixit conclusion — -it is not necessarily raised by the State's and Town’s affirmative claims. We thus do not see how jurisdiction would be appropriate under Grable.
The dissent also notes, apparently favorably, the district court's holding "that the state had the burden of proving at trial that the tribe's aboriginal title had been extinguished.” Id. at 143-44 n. 1. For that conclusion, the district court relied on 25 U.S.C. § 194, which provides that:
In all trials about the right of property in which an Indian may be a party on one side, and a white person on the other, the burden of proof shall rest upon the white person, whenever the Indian shall make out a presumption of title in himself from the fact of previous possession or ownership.
The district court's conclusion is erroneous in light of Wilson v. Omaha Indian Tribe, 442 U.S. 653, 667, 99 S.Ct. 2529, 61 L.Ed.2d 153 (1979), which held that Congress did not intend that states bear the burden set forth in 25 U.S.C. § 194. The Court’s reasoning also applies to towns. Furthermore, even if Section 194 were to apply here, it would appear to implicate the Tribe’s affirmative defense inasmuch as it places upon tribes the burden of “mak[ing] out a presumption of title” in the first instance.
. The dissent misunderstands what it construes as "[t]he majority[’s] proffer[ ] that the district court could have resolved the case without needing to reach whether Westwoods is Indian land.” Dissent at 145 n. 3. We articulate this "proffer” to illustrate the conceptual point that the issues regarding the Tribe's compliance with state and local law are distinct from the issues regarding the Tribe's federal immunities. Unlike the plaintiff’s quiet title claim in Grable, which had no content other than the federal law issue on which it was based, the State’s and Town's claims here challenging the Tribe’s non-com*141pliance with state and local law could be decided without reference to federal law. As noted in Part I of our discussion, it is irrelevant that the Tribe's non-compliance with state and local law was not actually in dispute: "it is now settled law that a case may not be removed to federal court on the basis of a federal defense, ... even if both parties concede that the federal defense is the only question truly at issue.” Caterpillar Inc., 482 U.S. at 393, 107 S.Ct. 2425. While we agree with the dissent that it is "beyond cavil” that the federal issues in this case are "necessary to the resolution of the state's claims,” Dissent at 145 n. 3, we do not see the relevance of this statement to the jurisdictional question. Complete defenses, by definition, always must be decided before a claim can be resolved.
. In arguing for the existence of subject matter jurisdiction, the dissent also relies on various considerations dealing with federal-state comity and the importance of the federal issue here. Dissent at 146-47. We do not see these considerations as part of the jurisdictional calculus. See Grable, 545 U.S. at 314, 125 S.Ct. 2363 ("[T]he question is, does a state-law claim necessarily raise a stated federal issue, actually disputed and substantial, which a federal forum may entertain without disturbing any congressionally approved balance of federal and state judicial responsibilities.” (emphasis added)).
. The dissent protests that the Oneida Indian Nation Court "found multiple bases satisfying federal subject matter jurisdiction”: (1) "the existence of a possessory land claim by a tribe in the complaint”; (2) " ‘the not insubstantial claim that federal law now protects, and has continuously protected from the time of the formation of the United States, possessory rights to tribal lands’ ”; and (3) jurisdiction *142under 25 U.S.C. § 233. Dissent at 145 n. 4 (quoting Oneida Indian Nation, 414 U.S. at 677-80, 94 S.Ct. 772). With regard to the first two bases, and as discussed above, the indisputably federal "Indian land" issue arose in Oneida Indian Nation in the context of the plaintiff's claim rather than as an affirmative defense, as it does here. As for 25 U.S.C. § 233, that law is not a basis for federal jurisdiction but a cession from U.S. courts to New York courts of jurisdiction over certain disputes involving tribes; in Oneida Indian Nation, the Court found jurisdiction consistent with Section 233 because the statute exempts from its jurisdictional cession civil land-dispute actions. See Oneida Indian Nation, 414 U.S. at 674 n. 9, 679-82, 94 S.Ct. 772.