The Attack on the Helicarrier was a successful attempt by Loki to escape from the Helicarrier and continue carrying out his plan to subjugate Earth.
Hawkeye, with the permission of Nick Fury, tested the security of the Helicarrier in a faux hostile insertion. He was able to infiltrate the ship and get through many of its checkpoints. He advised Fury of the ship's flaws that he was able to exploit.
In the Destruction of Project P.E.G.A.S.U.S., Loki had returned to Earth to conquer it. After destroying the Joint Dark Energy Mission Facility and stealing the Tesseract, Loki travelled to Stuttgart, Germany to steal Iridium.
Captain America and Black Widow travelled to Stuttgart in a Quinjet to confront him. Loki gets the upper hand on Rogers until Iron Man arrives and Loki surrenders. They take Loki into S.H.I.E.L.D. custody aboard the Helicarrier, where he was placed in a confinement capsule designed to hold the Hulk.
Loki taunted Nick Fury about his attempts to control the Tesseract and his gathering of misfits to defend Earth. Loki's mere presence was enough to provide a disruptive element that would fragment the only group of heroes that had any hope of stopping him.