A necropsy will be performed on the carcass of a pilot whale to determine how it died before washing up Tuesday night on a beach at one of the state’s most heavily trafficked state parks.

Hundreds of onlookers at Popham Beach State Park in Phippsburg gathered near the whale on Wednesday morning at the western end – nearest Morse Mountain – of the sprawling beach.

Spectators took photographs and watched as workers used an excavator to load the whale onto a flatbed and transported it to a composting facility in Litchfield.

The male whale measured 19 feet long and weighed an estimated 2.5 tons, according to Lynda Doughty, executive director of the nonprofit Marine Mammals of Maine.

Doughty said it appeared to be an older whale, based on its weight and length.

“He’s definitely no spring chicken,” Doughty said.

Marine Mammals of Maine was initially contacted around 9:30 p.m. Tuesday night by surfers, who spotted the whale at high tide. Doughty, who lives in the area, responded but decided it would be unsafe to try to move the whale in the heavy surf. She returned around 6 a.m. Wednesday morning at low tide.

There were no visible wounds or gashes on the carcass, and it seemed to be in good shape.

It is unusual to find a pilot whale alone, Doughty said.

“They are a very social species and are very connected to a group. When they get separated from the group, it’s pretty unusual,” Doughty added.

The whale’s soft tissues will be composted, but it’s skeleton will be preserved. Doughty said there is interest in having the skeleton moved to a museum if the permits can be obtained.

The pilot whale, like the killer whale, is a member of the dolphin family. Their intelligence is equal to that of a bottlenose dolphin and they can easily be trained, according to the American Cetacean Society.

Pilots whales are not considered endangered.