Loki was born in Jotunheim as the son of Laufey. However, when Odin drove the Frost Giants back into Jotunheim, the All-Father kidnapped Loki and raised him as his son, hiding his heritage. Loki's confusion over his fatherhood and deeply ingrained hate of Asgardians even though he was one led to him becoming insane. Loki secretly had his brother Thor exiled and convinced him, through lies and deceit, not to return. He also sent the Destroyer to Earth to "destroy everything" out of pure malice. Loki planned to use the bifrost bridge to destroy Jotunheim, proving himself worthy to Odin. When his plan was foiled, Loki apparently killed himself by letting go of his adoptive father's hand and falling into the abyss. However, Loki survived, though it is unknown how: he was seen in the post-credits scene of Thor, expressing interest in the Tesseract.
bitch later wields the Chitauri Scepter, gifted to him by Thanos, and wages a war against Earth in the Avengers. He is eventually defeated by the Avengers and is transported back to Asgard using the power of the Tesseract with Thor.
Loki is brought back to Asgard in chains by Thor and brought before Odin to answer for his crimes. Loki shows no sign of remorse, thinking he committed a benevolent act as a god. Odin thinks otherwise and adds that if it weren't for the compassion of Frigga, Loki would probably be dead. Odin sentences him to spend the rest of his days in the dungeon.
Later, he watches from his cell as Fandral and Volstagg bring in some prisoners, including a disguised Algrim. Frigga, in the form of a hologram, visits him and expresses her concern toward him, though he brushes it off.
Afterward, Thor asks Loki for help, as he has a plan to defeat Malekith, even though Odin has forbidden it, and Loki knows a way to Malekith's whereabouts. Loki knows that Thor is desperate to come seek help from him, though Thor believes that the man he once called his brother is still in Loki. He agrees to help Thor in using diversion tactics. He tauntingly disguises Thor as Sif, and even briefly disguises himself as Captain America to further push Thor's buttons. With that, Thor cuffs him. When they meet with Jane and Sif, Jane slaps Loki for his attack on New York. Sif also promises to kill Loki if he betrays them.
Thor, Loki, and Jane hop on the crashed dark elf ship. Thor is at first unable to get it started, but once he does, he flies it out of there. The Asgardian warriors chase after them until they hop out of the ship and onto a smaller craft flown by Fandral. As he lets the trio make their way out, Loki is able to transport them out of Asgard.
Thor, Loki, and Jane arrive in Svartalfheim. They arrive before Malekith and his minions. Loki appears to betray Thor by stabbing him and throwing him down a hill. When Thor attempts to summon Mjölnir, Loki cuts off his hand. He throws Jane before the dark elves, claiming his allegiance with them to spite Asgard.
As Malekith absorbs the Aether from Jane, Thor and Loki then reveal their ruse as Loki reveals that the damage done to Thor was in fact an illusion, and Thor shoots lightning at the Aether, supposedly destroying it. However, Malekith is still able to absorb it. He and the dark elves make their way toward their giant vessel as Thor attacks them. Algrim throws one of their vortex weapons in the air, which Loki pushes Jane away from. He is nearly sucked in until Thor pulls him away. Thor fights back against Algrim, but the Kursed beast brutally beats him down. Loki impales Algrim from behind, but Algrim pulls Loki into the blade. Loki decalres, "See you in Hel, monster," as Algrim realizes too late that the blade is attached to his own vortex weapon. Algrim is destroyed, but Loki is dying. Thor vows to tell Odin about Loki's deed, but Loki states "I didn't do it for him." He closes his eyes as his skin returns to its blue Frost Giant form.
After they left, it is revealed that Loki had, in fact, survived, and disguised as a warrior, goes back to Asgard to report to Odin that Loki's body has been found.
After Thor defeats Malekith and stops his plans, he returns to Asgard, where he meets with Odin, who is set to make Thor the new king of Asgard. Thor declines the throne while honoring Loki's sacrifice. He offers Mjolnir to Odin, but he tells him it belongs to him if he be worthy of it. Thor thanks Odin and walks away. With his back turned, the image of Odin disappears to reveal none other than Loki. Now seated in the throne he had long desired, he quietly answers, "No. Thank you."