New Hampshire’s highest court has cleared the way for a new Dunkin’ Donuts in Winchester.

On Monday, the state Supreme Court released an order upholding the decision to allow a gas station and convenience store with a Dunkin’ Donuts within to move ahead in town.

It was the culmination of a years-long legal battle between the owner of an existing gas station and grocery store in town and the town of Winchester, whose planning and zoning boards approved the Dunkin’ Donuts project.

In December, a judge in Cheshire County Superior Court had decided in favor of the town of Winchester. The Supreme Court on Monday affirmed the lower court’s decision.

The Winchester boards first rejected an application for the project in 2012, but a second application addressing those concerns was approved in 2013.

The tangled legal battle pitted the developers of the proposed Dunkin’ Donuts — S.S. Baker’s Realty Co. LLC — against Kulick’s Inc., a grocery store and gas station already in town.

Reacting to the order on Thursday, Kulick’s owner Stanley S. Plifka Jr. said he was disappointed by the court’s decision and still believed the project was unwise.

Kulick’s had argued that S.S. Baker’s had not properly addressed the concerns raised in its first application attempt with its second application, charges the state Supreme Court rejected Monday.

Kulick’s brought the case against the town of Winchester to Superior Court last year.

The proposed site for the gas station and Dunkin’ Donuts is at 4 Warwick Road, at a main intersection in town, and near Kulick’s, which is at 30-08 Warwick Road.

In S.S. Baker’s first application attempt, the town planning board raised safety issues relating to the proximity of the proposed parking lot to Routes 10 and 78. The board said that the parking lot was set up in a way that could interfere with the two roadways. Developers responded to those critiques in their second application by removing a parking spot and reducing the size of the proposed building to make more room.

Representatives for Kulick’s argued that the changes were not significant enough, but the court disagreed.

In its brief to the court, Kulick’s also said the town improperly allowed the developers to appoint their own engineer to oversee the site work, rather than the board hiring one, creating what it said was a conflict of interest. But board members had said bringing in a board-approved engineer was unnecessary because no engineer would jeopardize his or her license by cutting corners, reasoning that the Supreme Court agreed with.

Other arguments Kulick’s made against the town were that a one-year special exception granted by the planning board for a drive-through window had expired in 2013, and that it had improperly granted S.S. Baker’s two waivers that alleviated requirements for a landscape bed and 10-foot landscape buffer around the property.

In its order, the Supreme Court agreed with the lower court that the special exception could be frozen because of the extended legal battle. And it said that the board had been correct in finding that S.S. Baker’s showed unnecessary hardship to qualify for the waivers.

In its final submission, Kulick’s argued that the stormwater management plan that the town had approved violated town regulations. But the Supreme Court disagreed, noting that Kulick’s interpretation of the regulations was too narrow.

Monday’s order brings to an end a dispute that ignited a groundswell of support within the town for the proposed doughnut store. A Facebook page entitled “Stop Kulick’s Market — Winchester, NH wants their Dunkin Donuts” had accrued more than 1,000 likes since its creation in 2014.

On Thursday, as news of the court order broke, Facebook commenters on the page rejoiced, though many expressed cautious optimism around whether it was really over.

“It’s gonna be good for all you coffee drinkers but we heard this before so I won’t be holding my breath but hope it works out,” Roberta Carr wrote.

For his part, Plifka said that he wasn’t opposed to Dunkin’ Donuts specifically, calling himself a customer, but that he opposed the gas station project in particular.

“I’m still concerned about our water, concerned that it’s a dangerous intersection, and concerned about competition to other businesses in the area,” he said.

He said he harbored no bitterness toward the developers and wished them the best of luck.

“I did what I thought was best for the town,” he said, looking back on what he said was a self-funded legal fight over nine years.

“It is what it is; I’m moving forward.”

Ethan DeWitt can be reached at 352-1234, extension 1439, or edewitt@keenesentinel.com. Follow him on Twitter at @EDeWittKS