The Milky Way will be a victim of “galactic cannibalism” when it will be gobbled up by its neighbor, the Andromeda Galaxy, in about five billion years, according to a new study. Massive galaxies in the universe have stopped making their own stars and are snacking on their own kind to grow, the study reveals.

As part of the study, astronomers looked at more than 22,000 galaxies and found that smaller galaxies were very efficient at creating stars from gas, compared to their larger counterparts, which produce few new stars themselves, but instead grow by consuming other galaxies. The study was published in the journal Monthly Notices of the Royal Astronomical Society on Friday.

“All galaxies start off small and grow by collecting gas and quite efficiently turning it into stars,” Aaron Robotham of the International Centre for Radio Astronomy Research, or ICRAR, at the University of Western Australia and the study’s lead author, said in a statement. “Then every now and then they get completely cannibalized by some much larger galaxy.”

The Milky Way galaxy, for its part, is expected to grow by eating up two nearby dwarf galaxies -- the Large and Small Magellanic Clouds -- in about four billion years, until it gets its comeuppance from the Andromeda galaxy in nearly five billion years.

“Technically, Andromeda will eat us because it’s the more massive one,” Robotham said.

The study was based on data collected by using the Anglo-Australian Telescope in New South Wales as part of the Galaxy And Mass Assembly, or GAMA, survey, which was led by Simon Driver, a professor at ICRAR. The GAMA survey, which involved more than 90 scientists, took seven years to complete.

As galaxies grow, they generate more gravity and can more easily pull in their neighbors, according to Robotham. This gravitational power is expected to consolidate galaxies scattered in groups and clusters into a few super-giant galaxies. However, the process will take many billion years to happen.

“If you waited a really, really, really long time that would eventually happen but by really long I mean many times the age of the Universe so far,” Robotham said.