The vast Andromeda galaxy, next to ours, has a violent past that will culminate in it eating our Milky Way, astronomers say.

The galaxy's powerful past has seen it eat several smaller galaxies just as it will go on to swallow ours, researchers say.

They pieced together the violent history by finding the left-overs of those galaxies in large streams of stars.

That trail showed that it had eaten a number of galaxies in the last few billion years, before it goes on to destroy our own in about four billion years more. It appears to have been doing so as far as back as 10 billion years ago, when it was just forming, and those faint traces of smaller galaxies can still be seen to this day.

Astronomers hope that the research can shed light on how our own galaxy will eventually be swallowed, and how it will come to its end. But it also opens up new mysteries about why and how Andromeda is destroying the galaxies that surround it.

Best Nasa pictures of the month Show all 10 1 /10 Best Nasa pictures of the month Best Nasa pictures of the month The eye of Hurricane Dorian as captured by Nasa astronaut Nick Hague from onboard the International Space Station (ISS) on 3 September Nasa/EPA Best Nasa pictures of the month The River Nile and its delta captured at night from the ISS on 2 September Nasa Best Nasa pictures of the month The galaxy Messier 81, located in the northern constellation of Ursa Major, as seen by Nasa's Spitzer Space Telescope Nasa/JPL-Caltech Best Nasa pictures of the month The flight path Soyuz MS-15 spacecraft is seen in this long exposure photograph as it launches from the Baikonur Cosmodrome in Kazakhstan on 25 September Nasa/Bill Ingalls Best Nasa pictures of the month Danielson Crater, an impact crater in the Arabia region of Mars, as captured by Nasa's Mars Reconnaissance Orbiter spacecraft Nasa/JPL-Caltech Best Nasa pictures of the month A team rehearses landing and crew extraction from Boeing's CST-100 Starliner, which will be used to carry humans to the International Space Station at the White Sands Missile Range outside Las Cruces, New Mexico Nasa/Bill Ingalls Best Nasa pictures of the month Bound for the International Space Station, the Soyuz MS-15 spacecraft launches from the Baikonur Cosmodrome in Kazakhstan on 25 September Nasa/Bill Ingalls Best Nasa pictures of the month Hurricane Dorian as seen from the ISS on 2 September Nasa Best Nasa pictures of the month A string of tropical cyclones streams across Earth's northern hemisphere in this picture taken from the ISS on 4 September Nasa Best Nasa pictures of the month The city of New York as seen from the ISS on 11 September Nasa

"The Milky Way is on a collision course with Andromeda in about four billion years. So knowing what kind of a monster our galaxy is up against is useful in finding out the Milky Way's ultimate fate," said Dr Mackey from the Australian National University's Research School of Astronomy and Astrophysics.

"Andromeda has a much bigger and more complex stellar halo than the Milky Way, which indicates that it has cannibalised many more galaxies, possibly larger ones."

To piece together that ancient story, which is published in the journal Nature, researchers looked at dense clumps of stars that are known as globular clusters. Those show the signs of the ancient feasts, during which Andromeda would swallow its closer neighbours.

That allowed them to see the "fossils of long-dead galaxies", using them to understand the galaxies as they were when they lived, in the same way that fossils on Earth could shed light on ancient lives and deaths.

"By tracing the faint remains of these smaller galaxies with embedded star clusters, we've been able to recreate the way Andromeda drew them in and ultimately enveloped them at the different times," Dr Mackey said.

While the study helps answer important questions about the fate of our galaxy, it also opens up new questions and mysteries. Scientists say that Andromeda's two rounds of feeding came from entirely different directions.

"This is very weird and suggests that the extragalactic meals are fed from what's known as the 'cosmic web' of matter that threads the universe," said Professor Lewis from the Sydney Institute for Astronomy and University of Sydney School of Physics, who co-led the study with Dr Mackey.

"More surprising is the discovery that the direction of the ancient feeding is the same as the bizarre 'plane of satellites', an unexpected alignment of dwarf galaxies orbiting Andromeda."

Those planes can be torn up by Andromeda's own gravity within the space of a few billion years, according to previous research by the same scientists.

"This deepens the mystery as the plane must be young, but it appears to be aligned with ancient feeding of dwarf galaxies. Maybe this is because of the cosmic web, but really, this is only speculation," Professor Lewis said.

"We're going to have to think quite hard to unravel what this is telling us."

Astronomers also hope that the discovery could help us to learn more about our own galaxy, and how it will continue to evolve.

"One of our main motivations in studying astronomy is to understand our place in the Universe. A way of learning about our galaxy is to study others that are similar to it, and try to understand how these systems formed and evolved.