A developer somehow managed to build a $1.8 million waterfront home on land that was owned by a park, the Associated Press reported.

Now, after a legal battle, a court has decided that the house has to go.

WHO/flickr

Beavertail Lighthouse, above, sits across the bay from the site in Narragansett, Rhode Island, where a developer has been ordered to remove a $1.8 million home after mistakenly building it on land owned by a park. (NVinacco/flickr)

The construction took place in Narragansett, Rhode Island, where Four Twenty Corp. started building in 2009 — only to discover two years later when they tried to sell the place that the land on which they had built the home was owned by the Rose Nulman Park Foundation.

The developer tried to negotiate with the park, but the foundation has a clear no-development stance, as Friday’s court ruling against the developer noted.

“My client has wanted for a long time for the house to be removed,” the foundation’s attorney told WCVB-TV. “My client’s very clear and firm position is that it’s time for the house to go.”

According to the attorney, the developer has most of the permits needed to relocate the home, rather than tear it down, though the court’s pending decision on how much time the developer has to vacate the area might impact whether the house is moved or scrapped.

Follow Zach Noble (@thezachnoble) on Twitter