In a stunning turn, a federal district judge in Boston issued a ruling Wednesday that holds the Wampanoag Tribe of Gay Head (Aquinnah) must obtain building and other permits from the town of Aquinnah before constructing a bingo hall on tribal lands.

The decision marks a major victory for the town, which has fought tooth and nail over the question of local permitting since this winter, when the tribe used heavy machinery to clear four acres of land off State Road in Aquinnah to build a class II gaming facility. Construction has remained halted ever since, as the town took the Hail Mary step of asking a federal judge to enter final judgment in a case that had already been overturned by an appeals court.

The town wanted the court to clarify that while the tribe has the sovereign right to build a gaming facility, it still must abide by state and local permitting regulations.

A hearing was held on the town’s request in May, with U.S. District Court Judge Dennis Saylor 4th using the term “tenebrous” — a word defined as “dark, murky, or obscure” — to describe the question of whether the tribe had to follow local permitting regulations.

But in a memorandum accompanying the final judgment issued Friday, Judge Saylor was clear.

“The court will therefore enter a final judgment providing that any gaming facility constructed and operated by the tribe on the lands at issue is not subject to state and local laws concerning gaming. The judgment will further provide, however, that any such facility is otherwise subject to state and local regulation, including any applicable permitting requirements,” he wrote.

Ronald H. Rappaport, counsel for the town of Aquinnah, called it the decision important for the town.

“We’re very pleased that the court has made clear that the tribe has to comply with state and local laws — which I presume includes the Martha’s Vineyard Commission — for a commercial building,” he said. “While it has the right to game, it is still subject to local regulatory review and permits.”

Calls for comment to tribal counsel Scott Crowell and tribal chairwoman Cheryl Andrews-Maltais were not immediately returned.

The issue at hand goes back to early 2015, when Judge Saylor ruled against the tribe, preventing them from building a gambling facility on tribal lands within the town. The judge found at the time that the tribe had given up sovereign rights when it signed a land claims settlement agreement with the town in 1983 that ultimately led to the tribe’s federal recognition.

Judge Saylor’s decision was then reversed on appeal in 2017 — a reversal that granted the tribe the right to construct a class II gaming facility when the U.S. Supreme Court decided not to review the case a year later. The case was subsequently remanded to the U.S. District Court for final judgment.

Although final judgment is normally something of a formality, it was never issued in this case — until Wednesday.

In his memorandum, Judge Saylor wrote that while the tribe’s right to pursue gaming was affirmed by the First Circuit Court of Appeals, the tribe never asked the First Circuit to address the question of local permitting. Because the tribe only appealed the gaming aspects of his 2015 decision, the judge said, his final judgment left intact his earlier ruling that the tribe is subject to local permitting laws.

“The present dispute involves the form of that final judgment,” Judge Saylor wrote. “The court’s original judgment was not limited to gaming issues, but more broadly provided that the tribe must comply with ‘any state and local permitting requirements.’ That judgment reflected a dispute as to whether the tribe is subject to state and local permitting requirements (such as building permits, zoning, regional commission approval, and the like) not directly involving gaming. The tribe appealed the judgment as to the two gaming issues; it did not appeal as to the permitting requirements.”

When the tribe began clearing land for the bingo hall last February, both Chilmark and Aquinnah referred the project to the Martha’s Vineyard Commission as a development of regional impact (DRI). The tribe said it would not participate in the commission’s review process, asserting tribal sovereignty. The commission opened a public hearing on the project earlier this month, that was due to continue Thursday night. No spokesman for the tribe appeared at the first hearing, and there had been no contact from the tribe before Thursday night’s hearing, MVC executive director Adam Turner said.

William Jay, a partner with the Boston and D.C.-based law firm Goodwin who was hired by the town to help litigate the case, said Judge Saylor’s decision did not come as a surprise.

“We thought it was very clear that the tribe was required to comply with state and local laws that have nothing to do with gaming,” Mr. Jay said. “That was not surprising and entirely correct.”

He said the tribe could appeal the decision either by requesting Judge Saylor to reconsider his judgment or by filing a separate motion that would be heard in the U.S. Court of Appeals.

At the hearing in May, Judge Saylor said that if he did rule in favor of the town, it would not give the town the authority to stop the facility from being built, but would merely allow the town to permit and regulate certain aspects of the bingo hall.