More than 150 short-finned pilot whales stranded themselves Thursday on the southwestern tip of Australia, stunning parks officials and prompting a massive rescue effort to save as many as possible.

The mass beaching likely took place sometime Wednesday night to early Thursday morning, local time, at Hamelin Bay in Western Australia, according to the state's parks and wildlife service. Videos of the scene showed dozens of the animals piled against each other on the shore, many with their tails still wiggling, as onlookers expressed concern. Some whales were fully on dry land, while others were in shallow waters.

It's unclear exactly when the distressed animals were discovered — but by 9:30 a.m., about 75 of the whales had died, the parks service said. Officials soon shut the beach down, issued a shark alert for the area and rushed equipment and trained volunteers to the site to try to return the pilot whales to deeper water.

“The strength of the animals and the windy and possibly wet weather conditions will affect when and where we attempt to move them out to sea,” Jeremy Chick, incident controller for the parks and wildlife service, said at the time. “The main objectives are to ensure the safety of staff and volunteers as well as the whales' greatest chance of survival.”

Despite their efforts, by noon, dozens more had died, leaving only 15 of the stranded whales alive. By 4 p.m., that number had dwindled to seven surviving whales.

The rocky beach terrain and rough seas — as well as the now dozens of dead whales surrounding the live ones — were hampering rescue efforts most, officials said then.

“The conditions are challenging, but we are doing all we can to give these animals the best chance of survival without risking the safety of staff and volunteers,” Chick said, noting they would try to use boats to move the surviving animals to deeper water.

“Once we have moved the whales out we will monitor the situation closely as it is possible the whales will come back into shore and re-strand,” he said. “This has often been the case in previous mass strandings.”

At 7 p.m., the parks and wildlife service announced that all of the surviving pilot whales — six at final count — had at last been returned to deeper water. A photo of the scene showed a line of dark whale carcasses dividing the otherwise pristine beach and clear water.

There are numerous theories for why mass beachings happen — though the phenomenon has taken place for centuries, as documented by age-old engravings and paintings. Whales and dolphins are both cetaceans. They're social animals that travel in close-knit pods, and some scientists believe they can become stranded en masse if the dominant member leads the group too close to shore while chasing prey or becoming disoriented, according to Live Science.

Environmental groups have also argued that sonar — used to map the ocean floor or for military purposes — can trigger mass strandings in dolphins and whales, who can be sensitive to underwater noises.

The Western Australia parks service notes that short-finned pilot whales are particularly susceptible to getting stranded, citing two previous mass beachings that took place nearby in 1984 and 1991.

“They inhabit tropical and subtropical waters and may be seen in the hundreds but groups usually number less than 100,” the parks service said. “Short-finned pilot whales are closely related to long-finned pilot whales, although they have shorter flippers with less of an elbow. ... They have a bulbous forehead, but the flippers are less than 18 percent of the body length.”

Still, the largest mass stranding of whales in Western Australia involved long-finned pilot whales, when 320 of the animals beached themselves in 1996 in Dunsborough, some 55 miles north of Hamelin Bay. Last year, more than 400 long-finned pilot whales beached themselves in New Zealand; volunteers there were able to save 100 of the animals in time.

“It's one of the mysteries of nature,” Ben Tannock, a coordinator with the state's parks and wildlife service, told the Sydney Morning Herald Thursday, as workers frantically attempted to save as many whales as possible in this latest mass beaching. “Once they come ashore like that they do deteriorate quite quickly.”

Read more:

Woman dies after ‘acupuncture’ session that used live bees instead of needles

This gorilla doesn’t like getting his hands muddy, so he walks like a human, zoo says

Drone video captures killer whales eating a shark alive