The Asgardian Loki encounters the Other, the leader of an extraterrestrial race known as the Chitauri. In exchange for retrieving the Tesseract,Â˛ a powerful energy source of unknown potential, the Other promises Loki an army with which he can subjugate Earth. Nick Fury, director of the espionage agency S.H.I.E.L.D., and his lieutenant Agent Maria Hill arrive at a remote research facility during an evacuation, where physicist Dr. Erik Selvig is leading a research team experimenting on the Tesseract. Agent Phil Coulson explains that the object has begun radiating an unusual form of energy. The Tesseract suddenly activates and opens a wormhole, allowing Loki to reach Earth. Loki takes the Tesseract and uses his scepter to enslave Selvig and a couple of agents, including Clint Barton, to aid him in his getaway.
In response to the attack, Fury reactivates the "Avengers Initiative". Agent Natasha Romanoff is sent to Calcutta to recruit Dr. Bruce Banner to trace the Tesseract through its gamma radiation emissions. Coulson visits Tony Stark to have him review Selvig's research, and Fury approaches Steve Rogers with an assignment to retrieve the Tesseract.
In Stuttgart, Barton steals iridium needed to stabilize the Tesseract's power while Loki causes a distraction, leading to a confrontation with Rogers, Stark, and Romanoff that ends with Loki's surrender. While Loki is being escorted to S.H.I.E.L.D., Thor, his adoptive brother, arrives and frees him, hoping to convince him to abandon his plan and return to Asgard. After a confrontation with Stark and Rogers, Thor agrees to take Loki to S.H.I.E.L.D.'s flying aircraft carrier, the Helicarrier. There Loki is imprisoned while Banner and Stark attempt to locate the Tesseract.
The Avengers become divided, both over how to approach Loki and the revelation that S.H.I.E.L.D. plans to harness the Tesseract to develop weapons as a deterrent against hostile extraterrestrials. As the group argues, Barton and Loki's other possessed agents attack the Helicarrier, disabling its engines in flight and causing Banner to transform into the Hulk. Stark and Rogers try to restart the damaged engine, and Thor attempts to stop the Hulk's rampage. Romanoff fights Barton, and knocks him unconscious, breaking Loki's mind control. Loki escapes after killing Coulson and ejecting Thor from the airship, while the Hulk falls to the ground after attacking a S.H.I.E.L.D. fighter jet. Fury uses Coulson's death to motivate the Avengers into working as a team. Stark and Rogers realize that for Loki, simply defeating them will not be enough; he needs to overpower them publicly to validate himself as ruler of Earth. Loki uses the Tesseract, in conjunction with a device Selvig built, to open a wormhole above Stark Tower to the Chitauri fleet in space, launching his invasion.
The Avengers rally in defense of New York City, the wormhole's location, but quickly realize they will be overwhelmed as wave after wave of Chitauri descend upon Earth. Banner arrives and transforms into the Hulk, and together he, Rogers, Stark, Thor, Barton, and Romanoff battle the Chitauri while evacuating civilians. The Hulk finds Loki and beats him into submission. Romanoff makes her way to the wormhole generator, where Selvig, freed of Loki's control, reveals that Loki's scepter can be used to shut down the generator. Meanwhile, Fury's superiors attempt to end the invasion by launching a nuclear missile at Midtown Manhattan. Stark intercepts the missile and takes it through the wormhole toward the Chitauri fleet. The missile detonates, destroying the Chitauri mothership and disabling their forces on Earth. Stark's suit runs out of power, and he falls back through the wormhole just as Romanoff closes it. Stark goes into freefall, but the Hulk saves him from crashing to the ground. In the aftermath, Thor returns Loki and the Tesseract to Asgard, while Fury expresses confidence that the Avengers will return if and when they are needed.
In a mid-credits scene, the Other confers with his masterÂł about the failed attack on Earth. In a post-credits scene, the Avengers eat in silence at a shawarma restaurant.

Question: Who frees Loki from S.H.E.I.L.D. in an attempt to reason with him and return with him to Asgard?
Answer: Thor.
Alternative answer: Thor