Transformers 2 : Revenge Of The Fallen Thousands of years ago, there was a race of ancient Transformers who scoured the universe looking for energon sources. Known as the Dynasty of the Primes, they used machines called Sun Harvesters to drain stars of their energy in order to convert it to energon and power Cybertron's All Spark. The Primes agreed that life-bearing worlds would be spared, but in 17,000 BC, one Prime, thereafter dubbed "The Fallen", constructed a Sun Harvester on Earth. The remaining Primes sacrificed their bodies in order to hide the Matrix of Leadership — the key that activates the Sun Harvester — from The Fallen, who swore to seek revenge upon Earth.
In the present day, two years after the events of the previous film, Optimus Prime is seen leading a special forces unit known as NEST (Networked Elements: Supporters and Transformers), a military organization consisting of American and British troops and his own team of Autobots aimed at killing the remaining Decepticons on Earth. While on a mission in Shanghai, Optimus and his team destroy Decepticons Sideways and Demolishor, being given a warning by the latter that "The Fallen will rise again". Back in the United States, Sam Witwicky finds a splinter of the destroyed All Spark, and upon contact the splinter fills his mind with Cybertronian symbols. Deeming it dangerous, Sam gives the All Spark splinter to his girlfriend Mikaela Banes for safe keeping, and leaves her and Bumblebee behind to go off to college. Upon arrival, Sam meets his college roommate Leo Spitz, who runs an alien conspiracy website, and Alice, a co-ed who makes unusually strong sexual advances on him.
Decepticon Soundwave hacks into a US satellite and learns the location of the dead Decepticon leader Megatron and another piece of the All Spark. Ravage and Reedman attack the base, retrieve the shard, and use it to resurrect Megatron, who flies into space and is reunited with Starscream and his master, The Fallen, in the Nemesis. The Fallen instructs Megatron and Starscream to capture Sam in order to learn the location of the Matrix of Leadership.
Back home, Decepticon Wheelie tries to steal the shard, only to be captured by Mikaela. After having a mental breakdown and uncontrollably writing Cybertronian language in class, Sam calls Mikaela, who immediately leaves to get to him. With Sam's outbreaks worsening, Mikaela arrives at campus just as Alice — revealed to be a Decepticon Pretender — tries to attack him. An irate Mikaela, Sam, and his roommate Leo drive off, crashing into Alice, but are captured by the Decepticon Grindor, who delivers them to Megatron. The Decepticon known as "The Doctor" prepares to remove Sam's brain, but Optimus and Bumblebee manage to arrive in time and rescue Sam. Optimus attempts to hold off Megatron while Mikaela and Leo escape with Bumblebee. Megatron calls for reinforcements, Grindor and Starscream join the fight, and begin to overpower Optimus. Optimus kills Grindor and rips off Starscream's arm, but gets impaled by Megatron and dies. Megatron and Starscream retreat as the Autobots arrive to rescue Sam, but too late to assist Optimus.
After Prime's death, The Fallen — aware that only another Prime can kill him — departs the Nemesis. Megatron orders a full-scale assault on the planet. The Fallen speaks to the humans, demanding they surrender Sam to the Decepticons or they will destroy the world. Sam, Mikaela, Leo, Bumblebee, the twins and Wheelie regroup, and Leo suggests his online rival "Robo-Warrior" may be of assistance. Upon reaching Robo-Warrior, he turns out to be former Sector 7 agent Simmons. Simmons informs the group that the symbols Sam has been seeing should be readable for a Decepticon. Mikaela then releases Wheelie, who can't read the language, but identifying it as the language of the Primes, directs the group to a Decepticon seeker named Jetfire. They then find Jetfire disguised as the SR-71 in the center of the museum at the Steven F. Udvar-Hazy Center, and reactivate him via the AllSpark shard. After teleporting the group to Egypt, Jetfire tells that he changed his allegiance to the Autobots, and translates the symbols, which contain a riddle that sets the location of the Matrix of Leadership somewhere in the surrounding desert. By following the clues, the group arrive at a tomb where they ultimately find the Matrix, but it crumbles to dust in Sam's hands. Believing the dust of the Matrix can still revive Optimus, Sam collects the dust and instructs Simmons to call Major William Lennox to bring the other Autobots and Optimus' body.
The military arrives with the Autobots, but so does a new wave of Decepticons from orbit, and a battle ensues, with the Autobot/NEST team largely outnumbered. During the battle, several vehicles come together to form Decepticon Devastator, who unearths the Sun Harvester from inside one of the pyramids before being destroyed by a US Destroyer's railgun with the help of agent Simmons. Jetfire arrives and destroys Mixmaster, but is mortally wounded by Scorponok. Jetfire then kills him by smashing Scorponok's head with his fist. The Air Force carpet bombs the Decepticons, but Megatron avoids the bombings and fires at Sam, killing him. While dead, Sam is contacted by the Dynasty of the Primes who, acknowledging his courage and dedication to Optimus, revive him and give him the Matrix.
Sam awakens, and goes on to revive Optimus just before The Fallen ambushes him and his allies, slaughtering a few soldiers, stealing the Matrix and taking off to activate the Harvester. Jetfire sacrifices himself and surrenders his parts so that Optimus can incorporate them in order to fly to the Harvester and ultimately stop The Fallen. Now upgraded, Optimus successfully destroys the Harvester and engages The Fallen and Megatron in the ruins. Optimus blasts part of Megatron's face off, and kills The Fallen. With the battle finished, Megatron and Starscream retreat to the Nemesis. Optimus sends another message into space hoping to find more Autobots, saying that humans and Transformers both share a common past, and a future they will face together. During the credits, Sam is seen returning to college.