MONTGOMERY, Ala. — Alabama on Thursday settled a lawsuit filed by an environmental group that challenged the use of BP oil spill funds to build a 350-room beachside hotel and conference center.

The state agreed to commit long-standing funding for beach access, dune restoration programs, biking trails and other amenities to end the lawsuit that threatened a portion of the funding for the hotel being built at Gulf State Park. U.S. District Judge Ginny Granade approved the settlement agreement Thursday.

The New Orleans-based Gulf Restoration Network had sued over the use of the more than $50 million of early restoration funds for the project, arguing that wasn’t an appropriate use of coastal restoration dollars after the largest oil spill in U.S. history

Under the terms of the agreement, Alabama will provide $65 million over the next 20 years to maintain and operate public access amenities at Gulf State Park

“This settlement guarantees that public dollars will go to ensuring better public access to Alabama beaches. That’s what was supposed to happen in the first place,” Robert Wiygul, an attorney representing Gulf Restoration Network, said in a statement. “In case anybody missed the message, if you try to spend natural resource damage money on things like hotels or convention centers, we will take you to court,” he said

Alabama Conservation Commissioner Chris Blankenship said he was pleased with the settlement. “I feel like it alleviates some of their concerns. It will assure those amenities are taken of,” Blankenship said.

The state has continued with construction on the hotel despite the lawsuit. Blankenship said it is projected to open in the fall of 2018. The facility is being built on the site of an old lodge at the park that was destroyed by Hurricane Ivan in 2004.

Alabama Gov. Kay Ivey told reporters that the settlement will allow the final money to be released for the project.

“It is going to a crown jewel of the Gulf coast,” Ivey said.

The 2010 Deepwater Horizon rig explosion dumped 134 million gallons (510 million liters) of oil into the Gulf of Mexico. BP has since had to pay billions of dollars to make up for the damage.