For the first time, scientists have discovered a group of planets beyond the Milky Way, The Washington Post reported on Monday.

Xinyu Dai, an astrophysicist and professor at the University of Oklahoma in the United States, made the discovery using data from the National Aeronautics and Space Administration’s Chandra X-ray Observatory in space. Some of the planets spotted are the size of the moon, while some are as massive as Jupiter.

Dai told The Washington Post that as these planets are so far away – some 3.8 billion light years away – scientists cannot observe them through telescopes. So he and postdoctoral researcher Eduardo Guerras used Albert Einstein’s theory of relativity to find the galaxy beyond the Milky Way. Einstein’s theory posits that the force of gravity causes light to bend.

In this case, the scientists spotted the light from a quasar – the nucleus of a galaxy with a swirling black hole that emits an exceptionally large amount of energy. The galaxy’s gravitational force made the light heading towards the Milky Way bend and illuminated the galaxy in an effect known as microlensing.

The galaxy, Dai said, acts like a magnifying glass, bringing a previously unseen celestial body into X-ray view. “This microlensing is amplifying something that is very small and changing colors, which makes no sense, or it is amplifying a small region of a bigger object, and that object has different colours,” Guerras said.

“We can estimate that the number of planets in this galaxy is more than a trillion,” The National Geographic quoted Dai as saying.

The study was published on February 2 in The Astrophysical Journal Letters.