The ruling came Thursday, despite homeowners spending years in court trying to block the public from using the beach.

KENNEBUNKPORT, Maine — Maine's highest court has ruled Goose Rocks beach in Kennebunkport belongs to the town, not the homeowners who have spent years in court trying to keep the public off the beach.

The legal battle has plagued the shores of the beach for nearly 10 years.

Earlier this year, the York County Superior Court ruled in favor of the town as well, prompting homeowners to appeal the decision with Maine's Supreme Court. They filed a complaint against the town and anyone else who claimed title to the beach in front of their homes back in April.

According to Maine law, waterfront property owners own all the way to the low tide mark -- which is why homeowners on Goose Rocks beach have continued to fight for private access for their ocean side properties. However, there's a catch; the public trust doctrine and its meaning has been long disputed in the courts.

It allows the public to engage in acts of fishing, fowling and navigation in the intertidal zone, which is the sand between the high and low tide lines.

Despite homeowners making their case multiple times, the Justices on Maine's highest court ruled in favor of the town. According to the legal documents, they looked at hundreds of years of deeds and found the beach was never transferred to private hands.