While the Thanos, Gamora, and Marvel's heroes and villains to journey beyond the boundaries of reality and learn the ultimate truth - a truth which transformed how he views the multiverse and his place within it.

The Infinity Stones (or Infinity Gems) are cosmic artifacts which control Time, Space, Reality, Mind, Soul, and Power. At one point suggested to be the remnants of the ultra-powerful being Nemesis, the Infinity Stones have been destroyed and recreated in the past, but they continually return, apparently bound to the very fabric of reality. Used by Thanos to erase half of all life, the Infinity Stones live in infamy, but in Infinity Wars Loki gathered them to an ambitious end - breaching the final boundary of the God Quarry at the heart of creation and learning what lies beyond.

Related: Marvel Just Fixed the Infinity Stones by Respecting Their New Rules

Loki's journey takes place in Infinity Wars #5 and #6 from Gerry Duggan and Mike Deodato Jr., but is mysterious in nature, with more clarity added by Loki's explanation in Wolverine: Infinity Watch #5 from Duggan and Andy MacDonald. Having breached the God Quarry, Loki finds himself in "the Prime Universe" - a world littered with the discarded Infinity Stones of countless realities. In the sky hang beings who appear to be Celestials, one of which directs Loki to a black, reflective surface in which Loki guesses he will see his future. What Loki sees leaves him defeated, and he exits the Prime Universe, telling the Celestials that they should "stop casting rocks at our universe."

Loki Infinity Stones origin

In Wolverine: Infinity Watch, Loki explains more of what he witnessed, describing the Infinity Stones as "the skeleton keys of this universe, but they're controlled... they serve the wills of others." Loki's implication is that the Celestials of the Prime Universe cast a set of Infinity Stones into each reality, allowing whoever possesses them near-infinite power, but power which is ultimately wielded to the cosmic beings' own ends. While these beings look like regular Celestials in Infinity Wars, they take on a more uniform, ghostly appearance in Wolverine: Infinity Watch, suggesting they may be above the Celestials of other realities in power and influence.

While Loki doesn't spell out what the Prime Universe's Celestials actually want from casting Infinity Stones into the multiverse, the implication of Infinity Wars is that the Celestials are stand-ins for Marvel's writers. Loki calls them puppet masters, saying, "no-one but me writes my story." He tells the Celestials they need to grow up, asking whether they are influencing the lives of mortals "for us -- or for you?" Finally, when Loki looks into the black surface indicated by the Celestials, he is shown looking out at the reader before bursting into defeated laughter. While Loki may or may not totally appreciate that he's in a comic book, he does seem to realize his story is outside his control.

Loki Infinity Stones Quarry of Creation

However they're used within the individual realities they occupy, the Infinity Stones appear to all originate from the Prime Universe, cast into different realities so their Celestial masters can influence events (ultimately, it's implied, out of the same impulse that motivates any creator to complicate the lives of fictional characters.) Loki even learns that he's discovered this dispiriting truth before, only to change time to try and save himself the anguish. The Infinity Stones' heavy, meta origin may have been the last thing Loki wanted to hear, but it does fulfill the promise of artifacts that allow their to command reality itself, even to the point of realizing that they exist for someone else's amusement.

Next: The MCU Only Introduced Two of the Infinity Stones' Original Guardians