Sentinel Prime had made a deal with Megatron to use the pillars to transport Cybertron into Earth's atmosphere. Sentinel kills Ironhide. As Shockwave's forces invade Earth, Sentinel states the Megatron will never rule him.
In the final battle, American troops manage to destroy Shockwave. Sam kills Starscream using specially designed Cybertronian human weapons. Carly pep-talks Megatron into betraying Sentinel. With Sentinel incapacitated, and Optimus Prime with just one arm, Megatron taunts Optimus. Optimus attacks, decapitates Megatron with his trademark axe, and then finishes the job on Sentinel. Sam manages to take out the pillar being controlled by Sentinel. With no more space bridge, an incomplete Cybertron vanishes into a black hole. The world is safe forever.