JACKSON TOWNSHIP, N.J. (AP) — Six Flags and several New Jersey environmental groups have reached a settlement under which the theme park will cut down fewer trees to make way for a solar electricity farm.

The pact, which was revealed Wednesday, was reached last week.

READ MORE: Four Children Among Five Killed In Pottstown Home Explosion, Police Say

It calls for Six Flags to cut down 40 acres of trees at its theme park in Jackson Township, down from more than 90 acres under the original plan.

The pact calls for some of the solar panels to be built over parking lots at the complex. The remaining 52 acres will be added to a 213-acre tract that will be preserved.

“This settlement is a win for the environment and green energy,” said Jeff Tittel, director of the New Jersey Sierra Club, one of six environmental groups who sued to overturn local authorities’ approval of the plan. “Building a solar farm should be a positive for the environment and should not cause environmental damage in the process. Sometimes people think compromising gives away too much but in this case, we came out with a deal that benefits everyone.”

Although it was one of the plaintiffs in the suit, the Sierra Club withdrew from the case before the settlement. The other plaintiffs were Clean Water Action, the Crosswicks-Doctors Creek Watershed Association, the new jersey Conservation Foundation, Save Barnegat Bay and Environment New Jersey.

“Great Adventure came to the table ready to listen to the environmental impacts of their original plan, and through thoughtful and respectful communication, we came to an agreement on powering the park with solar without wreaking total environmental havoc,” said Janet Tauro, chairwoman of the board of Clean Water Action. “Going forward, this could be a model for the environmental and business communities working together.”

READ MORE: Beach Erosion Will Keep One-Third Of North Wildwood Beaches Closed Memorial Day Weekend

Six Flags said it is pleased a deal was worked out.

“Six Flags is proud to become the world’s first solar-powered theme park, and this project represents a giant step toward becoming a net-zero carbon facility,” park President John Winkler said. “Clean energy is right for the environment and our future, and we look forward to decades of environmental stewardship with our partner, KDC Solar.”

The company created a furor when it proposed the original plan that involved cutting down more than 90 acres of trees to make way for solar panels that would provide most of the park’s electricity needs.

Under the settlement, more than half the solar panels will be built atop an employee parking lot, an overflow parking lot and part of the parking lot for the complex’s water park.

KDC Solar will create habitat for the northern pine snake just outside the boundary of the project.

MORE NEWS: CBS3 SummerFest: 2 St. Joe's Grads Bringing New Tiki Cruise Experience For Adults To Wildwood

(© Copyright 2018 CBS Broadcasting Inc. All Rights Reserved. The Associated Press contributed to this report.)