NASA is investigating the force behind one of nature's longest-standing mysteries - why perfectly healthy whales, dolphins, and porpoises appear to lose all sense of direction, and end up stranded on a beach somewhere to die a slow and agonising death.

We're not talking about a few confused individuals occasionally getting lost here - mass strandings can involve hundreds of animals per event. And researchers now suspect that only something truly massive could be driving them to commit such deadly behaviour en masse - our Sun.

"There are some theories on why these animals beach in large groups, but not very good, solid explanations," astrophysicist Antti Pulkkinen from NASA's Goddard Space Flight Centre told Motherboard.

"One of the potential explanations that people have proposed is that since these animals use magnetic fields for navigation, magnetic anomalies could contribute."

For years, researchers have been trying to explain the mystery of fatal strandings by pointing to modern interferences, such as low-frequency sonar systems used by the US Navy that are known to negatively impact whales, dolphins, and walruses.

But while underwater technologies that send out competing sonar signals can disorient whales, dolphins, and porpoises - known collectively as cetaceans - they alone can't be what's driving the phenomenon. 

"[H]uman-made influences do not explain most of the strandings," Pulkkinen says in a press statement.

Instead, Pulkkinen and his team are looking at something that could have a much wider influence on these animals - the Sun's ability to mess with Earth's magnetic field, or magnetosphere.

To give you an idea of the extent of these stranding events, thousands of whales, dolphins, and porpoises beach themselves every year, and we've seen some record-breaking numbers of late.

In 2015, 337 dead whales were discovered off the coast of Patagonia in southern Chile - the largest whale stranding of baleen whales to date.

In 2009, 55 false killer whales found themelves stranded on a South African beach, and just last year, roughly 80 whales beached themselves on the Bay of Bengal coast in India.

They were reportedly so disoriented, of the 36 individuals that rescuers managed to get back into the sea, many of them ended up back on the beach.

Previous research has pointed to the Moon's gravitational influence as potentially messing with these animals' ability to navigate the open oceans - coastal storms and extreme tides around the full and new moon are thought to disorient them and drive them into dangerously shallow waters.

But no one's been able to convincingly link these events to the types of strandings we see, which has led NASA to search elsewhere for an explanation.

They're now proposing that, seeing as cetaceans use magnetic-field sensing to navigate, it's time to consider the thing that messes with Earth's magnetic field the most - solar storms.

Solar storms are caused by massive bursts of harmful cosmic rays fired at Earth's magnetosphere from the Sun, which can disable satellites, cause widespread blackouts, and disrupt our GPS-based navigation.

These highly charged particles are so powerful, they can easily penetrate the hull of a spacecraft, and Earth's magnetic shield is our first line of defence against them, but sometimes, even it struggles.

One particularly powerful solar storm in 2015 appeared to 'crack open' Earth's magnetosphere, as a giant cloud of plasma was ejected from the Sun's outer atmosphere, and struck our planet's magnetic field at speeds of about 2.5 million kilometres per hour (1.5 million mph).

At the time, researchers were mainly worried about our communications systems, but NASA is now launching an investigation to see if such events could be behind mysterious mass strandings that can kill hundreds of cetaceans at once.

It's early days, but the researchers are hopeful that they'll come up with some definitive answers - one way or another - because of how many of these strandings they already have to investigate.

"We estimate that records on the order of hundreds of cetacean mass strandings will be available for study, thus making our analyses statistically significant," says Pulkkinen.

"So far, there has been very little quantitative research - just a lot of speculation. What we're going to do is throw cold, hard data at this. It's a long-standing mystery, and it's important that we figure out what's going on."

We can't wait to see the results, because if it the answer is solar storms, scientists are already working on ways that we can forecast them better, so it could give researchers in stranding 'hot-spots' like New Zealand, Australia, and Cape Cod, Massachusetts a better chance of detecting and responding to such events. 

"If we understand the relationship between the two, we may be able to use observations of solar storms as an early warning for potential strandings to occur," says one of the team, Katie Moore, from the International Fund for Animal Welfare's global Animal Rescue Program. 

"This would allow stranding responders in global hotspots, and really around the world, to be better prepared to respond, thus having the opportunity to save more animals."