OWLS HEAD, Maine — A couple will not be able to build a house as close to shore as they wanted after a judge overturned a ruling by the town planning board.

Justice Daniel Billings ruled Tuesday in Knox County Unified Court that the Owls Head planning board erred in giving approval to Doug Johnson of Osprey Family Trust to build the house near the same location as a dilapidated deckhouse from a boat that had been placed on shore and used decades ago as a camp.

The deckhouse is located 45 feet from the normal high-water mark of the ocean, and Johnson wanted to build a house at that location. State shoreland laws limit construction within 75 feet of shore. But Johnson argued the house should be grandfathered because he was renovating the existing camp.

He filed an application for the project in 2013 and, after seven meetings, the planning board approved the house being built.

Neighbors Claire Perry and Jill Delaney, however, appealed that decision to the town’s zoning board of appeals. In May 2014, the zoning board ruled the planning board made an error and that the house should not have been allowed so close to the water.

Johnson appealed that decision to the court.

“The evidence in the record compels a finding that the existing structure could be relocated further from the ocean,” Billings ruled. “Therefore, the planning board’s decision is unsupported by the substantial evidence on the record and must be overturned.”

Johnson’s attorney, Paul Gibbons of Camden, said he was surprised by the ruling and will be discussing with his client whether to file an appeal. Gibbons pointed out that there are wetlands on the property further from the shore that would limit the size of the house that could be built if it were more than 75 feet from shore.