The origins of a mysterious ribbon of gas that stretches nearly halfway around the Milky Way has been discovered by astronomers using the Hubble Space Telescope.

Ever since its discovery 40 years ago, astronomers have wondered where the Magellanic Stream originated. And now they have their answer. The stream was, for the most part, stripped from the Small Magellanic Cloud around two billion years ago.

The Small Magellanic Cloud is one of the dwarf galaxies that orbit our own. Computer models had predicted that the stream had been torn entirely from the smaller cloud, which is why astronomers were surprised to discover that a small part of the Magellanic Stream was also torn more recently from the larger of the Magellanic Clouds.

The sources were finally determined by using Hubble's Cosmic Origins Spectrograph and the European Southern Observatory's Very Large Telescope. Along most of the stream, the team found low abundances of oxygen and sulphur that correlated with levels found in the Small Magellanic Cloud two billion years ago. The composition of an inner region of the stream, however, was found to be full of heavy elements that made it more consistent with the Large Magellanic Cloud.

"We now know which of our famous neighbors, the Magellanic Clouds, created this gas ribbon, which may eventually fall onto our own galaxy and spark new star formation. It's an important step forward in figuring out how galaxies obtain gas and form new stars," says Andrew Fox, a staff member supported by ESA at the Space Telescope Science Institute, USA.

Of all our neighboring galaxies, the Magellanic Clouds are the only ones that haven't lost all of their gas content, which is why they are able to form new stars. Astronomers believe the stream was torn from the clouds due to the gravitational tug between them combined with pressure from the hot halo surrounding the Milky Way.

The discovery has been detailed in a set of two papers, both published in the August issue of The Astrophysical Journal.

This story originally appeared on Wired UK.