Researchers have for the first time discovered how some animals sense the Earth’s magnetic field.

A study on worms gathered from around the world has shown that each is acutely aware of its place on the planet, and uses it in the search for food.

It is an exciting find for biologists, who say it is a big clue to the mystery of how animals' internal compasses work.

There are many animals that navigate using the Earth's magnetic field - as migrating geese, sea turtles, butterflies and wolves to name a few – but until now, no one had pinpointed quite how they do it.

A team of scientists and engineers at The University of Texas looked at worms of the species C. Elegans, which dig vertically downward in the search for food.

They gathered worms from different parts of the world - Hawaii, England and Australia, for example – and placed them in gelatine-filled tubes.

In the lab, the international cohort of worms did not all move in the same direction.

Rather, depending on where they were from - Hawaii, England or Australia, for example - they moved at an angle that would have corresponded to down, if they had been in the magnetic field of their home.

For instance, Australian worms appeared to move upward in tubes.

The orientation of Earth’s magnetic field changes from place to place, and it appears that each worm's magnetic field sensor system is finely tuned to its local environment, allowing it to tell up from down.

The team identified the physical part of the worm’s brain that allows them to do this, the first time the stunning directional awareness of animals has been linked to a specific point.

The sensor is a microscopic structure at the end of a neuron that looks like a nano-scale TV antenna.

Given the similarities in brain structure across species, researchers say it is likely that other animals share the same ability.

The researchers discovered the worms' magnetosensory abilities by altering the magnetic field around them with a magnetic coil to affect behaviour.

In other tests, worms which were genetically engineered to have a fault in the particular neuron did not orient themselves up and down as normal.

The researchers also used calcium imaging to demonstrate that changes in the magnetic field cause the neuron to activate.

In 2012, scientists announced the discovery of brain cells in pigeons that process information about magnetic fields, but they did not discover what actually senses the fields.

“It's been a competitive race to find the first magnetosensory neuron,” said a researcher on the more recent study, Jon Pierce-Shimomura.

“And we think we've won with worms, which is a big surprise because no one suspected that worms could sense the Earth's magnetic field.”

Interestingly, the neuron that sports a magnetic field sensor, called an AFD neuron, can also sense carbon dioxide levels and temperature.

The study is published in the journal eLife