Having fallen through a wormhole, Loki found himself in Sanctuary, where he met Thanos and The Other. Thanos, who wished to acquire all six Infinity Stones, had discovered that the Tesseract, which contained the Space Stone, was on Earth. Loki, who wished to subjugate Earth, made a deal with Thanos, offering to retrieve the Tesseract for the Mad Titan in exchange for Thanos giving him his Chitauri army. Thanos agreed, and lent Loki his Scepter, which contained the Mind Stone, to aid him in his efforts. As Loki arrived on Earth and stole the Tesseract from S.H.I.E.L.D., The Other warned him that if he failed to deliver the Tesseract, Thanos would find him. Loki's attempts to subjugate Earth were thwarted by the Avengers, with Thanos losing both stones as the Tesseract was taken to Asgard while the Scepter was taken by S.H.I.E.L.D.
Five years later, following the destruction of Asgard, Thor and the surviving Asgardians charted a course for Earth, intending to resettle there. A few months later in 2018, as the Statesman made its way through space, Thor and Loki witnessed the Statesman being intercepted by the Sanctuary II, a warship under the command of Thanos. Unbeknownst to Loki, Thanos had tracked him down with the sole purpose of obtaining the Tesseract, which Loki had taken from Odin's vault prior to Asgard's destruction, which, in turn, would bring him one step closer to achieving his goal of exterminating half of all life in the universe.
- "This is the Asgardian refugee vessel Statesman! We are under assault! I repeat, we are under assault! The engines are dead, life support failing. Requesting aid from any vessel within range. We are twenty-two jump points out of Asgard. Our crew is made up of Asgardian families."
- ―Asgardian Distress Call[src]
Boarding the Statesman, Thanos and his four adoptive children – Ebony Maw, Cull Obsidian, Proxima Midnight, and Corvus Glaive – executed half of the ship's population while Valkyrie led the other half to the escape pods, which ferried them to safety.
Thanos then threatened to use the Power Stone, which he extracted from the Orb following his assault on Xandar, to kill Thor unless Loki surrendered the Tesseract. Loki initially concealed the fact that the Tesseract was in his possession, expressing an initial lack of empathy towards Thor, but acceded to the Mad Titan's demands after he activated the Power Stone and began using it to painfully torture Thor. As Thor claimed the Tesseract had been destroyed on Asgard during Ragnarök, Loki reluctantly revealed the Tesseract in his hand, much to Thor's dismay.
As Loki began to reassure Thor that they would survive the ordeal, Thanos derided his misplaced optimism as he reached for the Tesseract, calling him an Asgardian. Reminding Thanos that he wasn't an Asgardian, Loki also reminded him that they had Hulk on their side. This remark signaled the Avenger to immediately spring from hiding and ambush the Mad Titan, tackling him to the ground before he could retrieve the Tesseract.
Although Hulk initially gained the upper hand, Thanos was quickly able to overpower and defeat the Avenger alone in hand-to-hand without any aid from the Power Stone or his Children, rendering Hulk unconscious. A freed Thor attempted to attack Thanos, only to be restrained telekinetically by Ebony Maw. However, his attack provided a momentary distraction, allowing the injured Heimdall to channel the Bifrost using Dark Magic. The Bridge managed to send Hulk to Earth before Thanos could kill him. Remaining calm despite this, the Titan took Corvus' glaive and chose to kill Heimdall instead by impaling him through the heart, enraging Thor.
Telekinetically muffling Thor, Maw retrieved the fallen Tesseract and presented it to Thanos. The Titan took the cube, crushing it in his bare hand to reveal the Space Stone, and placing it in the next slot of the Infinity Gauntlet. Admiring the Stone, Thanos proceeded to task his Children with retrieving the Mind and Time Stones from Earth, before rendezvousing with him on Titan. Loki, having remained hidden, offered to aid Thanos and act as a guide on their attack on Earth.
However, as he pretended to worship the skeptical Titan, Loki attempted a last-ditch improvised attack to assassinate Thanos with a hidden knife. His attack was unsuccessful, and was anticipated and immediately thwarted by Thanos, who used the Space Stone to freeze Loki mid-attack. In retribution, Thanos held Loki up in the air by the neck, choking him with the Gauntlet. As Loki taunted him one final time, Thanos killed him by snapping his neck, before tossing his corpse down to a vengeful and heartbroken Thor, who was told that he can't be resurrected and could do nothing to stop him.
With his job now complete, Thanos used the Power Stone to overload the Statesman with energy, before leaving with his Children to continue their quest. A weakened and badly wounded Thor held his brother's corpse before the ship violently detonated, leaving Thor and the dead Asgardians floating adrift in space.
Arriving on Earth, Hulk, after crashing into the New York Sanctum and turning back into Bruce Banner, warned Doctor Strange and Wong about Thanos' crusade. This led to Strange recruiting Tony Stark and the Avengers becoming aware of the Mad Titan's plan.
Learning of the Future
In 2023, the Avengers traveled back in time as part of their Time Heist, creating an alternate 2012 timeline. Their actions inadvertently caused an alternate Loki to abscond with Tesseract in the aftermath of the Battle of New York. Loki was swiftly arrested by the Time Variance Authority, who showed him footage of his original fate had he not escaped from the Avengers in 2012. Loki saw the footage of how Thanos murdered his original timeline self aboard the Statesman, which made him rethink his self-proclaimed glorious purpose in life.
Faking His Death
In an alternate universe, rather than physically confront Thanos himself, Loki instead used his magic to cast an illusion of himself while he hid as inanimate debris. His illusion, which confronted Thanos with a dagger, was powerful enough that Thanos was able to snap its neck without being able to notice that it wasn't real.
As Thanos destroyed the Statesman, Loki found himself drifting through space, and thought about his place in the universe and how he caused pain and suffering to everyone he came across. Feeling remorse for his actions, Loki exiled himself on an isolated planet, believing that he was making a positive change by removing himself from the world. After many years, he found himself missing Asgard and his brother, who believed him to be dead, and decided to end his exile and reunite with Thor. However, as he attempted to end his isolation, he was immediately arrested by the Time Variance Authority, who pruned him and sent him to the Void.
- Thor: Ragnarok
- Avengers: Infinity War