The Universe is swarming with galaxies, billions upon billions as far as the eye can see. And among this multitude, some galaxies really stand out in a spectacular way.

These are the quasar galaxies. Powered by an active supermassive black hole guzzling material at such a tremendous rate, they blaze with some of the brightest light in the Universe, lighting up the galactic center right across the electromagnetic spectrum. For decades, astronomers have wondered why some galaxies have such extreme activity and others do not.

Now they think they've cracked it. By making a careful study of nearby quasar and non-quasar galaxies, a team led by astrophysicist Jonny Pierce of the University of Hertfordshire in the UK concludes that, in a majority of cases, quasar activity is triggered when two galaxies start the process of colliding and merging.

This tells us that, in a few billion years when the Milky Way starts to merge with Andromeda, our own galaxy is likely to become a blazing quasar. Not that Earth, let alone anything remotely human, is likely to be around to see it.

"Quasars are one of the most extreme phenomena in the Universe, and what we see is likely to represent the future of our own Milky Way galaxy when it collides with the Andromeda galaxy in about five billion years," says astrophysicist Clive Tadhunter of the University of Sheffield in the UK.

"It's exciting to observe these events and finally understand why they occur – but thankfully Earth won't be anywhere near one of these apocalyptic episodes for quite some time."

Black holes are the darkest thing in the Universe, so it seems a little ironic that they're the driving force behind some of the brightest light we can see. Nevertheless, although we can't see the black hole itself – the event horizon is, as far as we know, impassible from within – the activity around it can get intense.

When a black hole "feeds" on material in its orbit, the mix of matter doesn't simply drop straight down its throat. It swirls at great speed like water circling a drain. The extreme friction and gravity heat the material to incredible temperatures, making it glow with light across the spectrum. The more material, and the stronger the gravitational field, the more light the material produces.

Quasars are supermassive black holes that are accreting material at pretty much the limit of how fast they can feed; if the material grew any brighter, the outward radiation pressure would exceed the inward pull of gravity, pushing the material back out into space. Black holes can exceed this limit for short bursts of time, but not for the sustained accretion observed in quasars.

The question, however, was where the material comes from, and this has been challenging to study. That's because studying the flows of material towards and around the galactic centers of quasar galaxies is really hard. The structures are usually too small to see at the distances of most quasars, and the galactic centers glare too bright to see much detail.

In addition, the events that trigger the quasar activity likely take a lot longer than the quasar activity lasts. That means that for every quasar galaxy with signs of the trigger activity, there are many more displaying the same characteristics with any quasar activity yet to commence.

Some studies have therefore focussed on populations of quasars, from which galaxy collisions have emerged as a candidate cause. As promising as they are, conclusions have been somewhat ambiguous. So Pierce and his colleagues undertook a more detailed investigation of 48 nearby quasars, within about 3.5 billion light-years, comparing them to 100 similar galaxies with no quasar activity.

They found that a good two-thirds of the quasars in their sample showed signs of being gravitationally disturbed by an encounter with another galaxy. That's three times the rate of gravitational disturbance they found in the non-quasar galaxies – and likely, the researchers said, the lower limit of the true rate of disturbance in quasar galaxies.

When two galaxies collide, huge amounts of gas are gravitationally dragged towards the supermassive black hole, giving it a glut of fresh material to feed on. Interestingly, the team found that many of the disturbed quasars they observed were still in the pre-merger phase, showing that gas flows to a galactic center can trigger quasar activity long before the two galactic nuclei merge.

There are still some gaps in our understanding, though. Galaxy interactions may be the most common trigger for quasar activity, but there are other ways in which quasar activity may be switched on. Those need to be investigated too.

"Although our results indicate that the gas flows associated with galaxy interactions can provide sufficient mass infall rates to the central supermassive black hole to trigger quasar activity even well before the two nuclei have coalesced, some objects are triggered in a post-coalescence phase," the researchers write.

"Moreover, a minority of our sample are disc galaxies that appear undisturbed in deep imaging observations. Therefore, secular processes may sometimes be capable of triggering quasar activity, even if this is not the dominant mechanism at low redshifts."

The research has been published in the Monthly Notices of the Royal Astronomical Society.