A superior court judge has ruled in favor of the town of Chilmark, upholding a complicated three-way land swap designed to create affordable housing, add conservation land and save a historic home.

The Howard B. Hillman family is bound to follow an agreement struck with the town and the Martha’s Vineyard Land Bank more than six years ago, the Hon. Gary A. Nickerson found.

“The agreement prevails and the bargain struck in October of 2007 is to be enforced . . .” Judge Nickerson wrote in the 13-page decision. “No one in this case is naive,” he also wrote.

In 2007, the town entered into an agreement with the land bank and the Hillman family. The deal centered on the historic Engley home off Middle Road in Chilmark, which had been purchased by the town and the land bank years earlier. The original plan called for converting the home into affordable housing and put a conservation restriction on the land around it. The Hillman family owns more than 100 acres surrounding the Engley property. The later deal called for the Dora B. Hillman Trust to take ownership of the Engley home in exchange for a trail easement for the land bank and the donation of 10 acres of land for the land bank and affordable housing. Chilmark voters authorized selectmen to execute the deal, and the state legislature created an act authorizing the swap in 2008.

Two years after the deal was struck, the Hillman family said it was no longer valid, citing time that had gone by and concerns about the conservation restrictions on the property. The town filed a lawsuit to compel the trust to complete the deal.

A three-day trial was held in August in Edgartown with Judge Nickerson presiding.

At trial Jennifer Roberts, an attorney representing the Hillman family, said the length of time that went by and the lack of communication from the town made the deal a “dead letter.”

Chilmark town counsel Ronald H. Rappaport said the deal consisted of many complicated moving parts and had proceeded in good faith at every step.

Other documents that came to light during the case showed that the Hillman family’s financial situation had also changed between 2007 and 2008.

In his Jan. 21 decision, Judge Nickerson sided with the town and said the contract is enforceable. “All involved in drafting the agreement were sophisticated individuals aware of the inherent delays in dealing with the complex issues affecting the transfer of public lands,” the judge wrote. “Everyone knew the prerequisites . . . and the other conditions . . . would require considerable time to perfect.”

The ruling orders trustees to fulfill their obligations under the agreement within 30 days.

An appeal in the case is possible. Ms. Roberts could not be reached for comment.

The town attorney and land bank executive director James Lengyel both praised the outcome.

Mr. Rappaport called the decision “a terrific win for the town.”

“The judge recognized that the town entered into this agreement for several purposes,” he said, with objectives to preserve land, preserve the historic Engley house, provide affordable housing and open space preservation. “All of these things were achieved in this one transaction, so we're very pleased that the actions of the transaction were upheld by the court,” he added.

“This is happy news for the town and the land bank since we all did work very hard to put together a good plan,” Mr. Lengyel told the Gazette Tuesday.