It is three years after the events of Attack of the Clones. The Galactic Republic is in the midst of an epic war with the Confederacy of Independent Systems under the leadership of the Sith Lord, Count Dooku. The Confederacy's cyborg military leader, General Grievous of the Separatist Droid Army has infiltrated Coruscant and captured Supreme Chancellor Palpatine, leader of the Galactic Senate.
As the Droid Army attempts to escape Coruscant, a massive space battle erupts, into which race Jedi Knight Anakin Skywalker and Jedi Master Obi-Wan Kenobi, leading a mission to rescue the Chancellor. The Jedi fight through the Separatist armada. In the process, Obi-Wan's interceptor is damaged by buzz droids and his astromech, R4-P17, is destroyed. Anakin attempts to shoot the droids off, though succeeds only in blasting apart the wing of his former Master's vessel. Obi-Wan tells Anakin to hold his fire as he's not helping. Anakin agrees it was a bad idea. Obi-Wan tells Anakin to go on and rescue the Chancellor, but Anakin says he won't leave without Obi-Wan. Anakin uses his fighter to knock some of the buzz droids off Obi-Wan's fighter, but one manages to crawl onto Anakin's ship although it is quickly disabled by R2-D2. As they approach Grievous's flagship, Obi-Wan reminds Anakin their shields are still up and so Anakin breaks formation and attacks a shield generator, knocking out the shields on the docking bay of the ship and the two Jedi crash land into the hangar of the Trade Federation Cruiser Invisible Hand, the Separatist flagship just as the protective doors close, sealing the atmosphere in the ship.
Anakin and Obi-Wan make their way through the flagship, fighting through an army of droids. Meanwhile, R2-D2 aids them from the hangar bay while simultaneously fending off a pair of super battle droids.
The Jedi reach the General's Quarters, finding the captive Chancellor Palpatine. They are confronted by Dooku himself, and a lightsaber battle ensues. During the battle, Obi-Wan is rendered unconscious when Dooku uses the Force to hold him in mid-air before hurling him against a railing.
Anakin continues the battle, winning the duel by giving in to his anger, cutting off Dooku's hands and taking the Sith Lord's lightsaber. With Dooku on his knees, Anakin scissors the lightsabers to Dooku's neck, and, with encouragement from Palpatine, beheads the helpless Count.
An explosion occurs deep in the ship, brought on by the attack of the Venator-class Star Destroyer Guarlara, causing the Invisible Hand to begin an uncontrolled descent into Coruscant. Despite Palpatine's persuasions that he should leave him, Anakin carries the unconscious Obi-Wan on his back, and maneuvers through the ship with the Chancellor. Obi-Wan later regains consciousness.
After Grievous has the bridge crew regain control of his flagship by firing the emergency booster engines, he makes certain the two Jedi and their ward are captured. Having fallen foul of a ray shield trap, the three are brought to the bridge under custody, but R2 successfully creates a distraction, allowing the Jedi to retrieve their lightsabers and break free.
Grievous then sends his powerful IG-100 MagnaGuards after the Jedi. Obi-Wan quickly beheads IG-101 with his blade, but the droid continues the fight, forcing Obi-Wan to slice the warrior apart before it deactivates. Anakin finishes off IG-102 and destroys the battle droids attempting to drag Palpatine from the bridge. The Jedi close in on Grievous, though the wily General smashes a window with his fallen guard's electrostaff, and is swept outside. Using a tow cable, Grievous latches himself to the ship and heads for the escape pods. Launching all other escape capsules, Grievous speeds for the safety of a Trade Federation Lucrehulk-class battleship. Once again, the flagship begins to descend in a free-fall into Coruscant, but Anakin takes the controls and pilots the ship into a hard landing, aided by emergency firespeeders, on one of Coruscant's industrial landing platforms.
On Coruscant, Anakin is praised for his heroics. He meets secretly with Padmé Amidala, and they share a kiss in the shadows of the Republic Executive Building, keeping their love secret. She reveals to him that she is pregnant with their child. Later, Anakin awakens in a panic, covered in sweat. He reveals to Padmé that he has been dreaming about her dying in childbirth, and he vows not to let this dream come true.
Chancellor Palpatine requests Anakin's presence, and they meet in the Chancellor's office. The Senate has granted the Chancellor further emergency powers, giving him direct control of the Jedi High Council. Palpatine confides in Anakin his fear, distrust, and contempt of the Masters. He appoints Anakin to be his personal representative on the Council.
The High Council begrudgingly accepts Anakin's appointment, but does not grant him the rank of Master. Anakin reacts angrily at this perceived slight. Ignoring his outburst, the Council goes on to discuss matters concerning the war. It is decided that Anakin will be assigned to protect the Chancellor, and Yoda will take a battalion of clones to reinforce the Wookiees on Kashyyyk. Anakin is angry and disappointed.
Obi-Wan later tells Anakin that the Council wants Anakin to report on all the Chancellor's dealings, essentially spying on him. Anakin is confused and upset, feeling torn between two friends and loyalties. Obi-Wan himself is unhappy with the situation.
At the Galaxies Opera House in the Uscru District, Anakin joins Palpatine in watching the Mon Calamari Ballet performing Squid Lake. Palpatine tells Anakin that their Clone Intelligence units have located General Grievous and that he's hiding in the Utapau system. Anakin is excited that they may finally be able to capture Grievous and end the war. Palpatine tells Anakin that he'd question the competence of the Jedi Council if they don't send him for the mission. Then wanting Anakin to sit down, he tells his aides with him in the box to leave them. With only Palpatine and Anakin (and two red guards at the door) left in the box, Palpatine continues to seduce Anakin to the dark side, making him mistrust the Jedi by telling him that the Order wishes to overthrow the Republic and that if he has suspected it, Anakin must surely have sensed it. Anakin confirms that the Jedi don't trust him, a fact that Palpatine expands to include the Senate, the Republic and democracy as a whole. Anakin tells Palpatine that his trust in the Jedi has been shaken and Palpatine deduces that the Council wants Anakin to spy on him and that it makes Anakin feel dishonest. Palpatine takes Anakin back to some of the early political lessons Palpatine tried to teach him, about how all those who gain power are afraid to lose it and that includes the Jedi. But Anakin tries to defend the Jedi by saying they use their powers for good. But according to Palpatine good is only a point of view, noting that in almost every conceivable manner, including a quest for greater power, the Sith and the Jedi are exactly alike. Anakin compares them by saying that the Sith depend on their passions for their strength and they only think of themselves whereas the Jedi are selfless, thinking only of others. After a brief pause in their conversation, Palpatine asks if Anakin has ever heard the tragedy of Darth Plagueis The Wise and Anakin says he hasn't. This does not surprise Palpatine as he calls it a story the Jedi wouldn't tell him. Palpatine describes Darth Plagueis as a Dark Lord of the Sith who was so powerful and wise that he could use the Force to influence the midi-chlorians to create life, having such power and knowledge of the dark side that he could use it to save people he cared about from death, a statement which gets Anakin's attention (which was Palpatine's desire) and Palpatine describes the dark side of the Force as a pathway to many abilities considered by some to be unnatural. When Anakin asks what happened to Darth Plagueis, Palpatine finishes the story by telling Anakin that Plagueis became so powerful that all he feared was losing his power which he eventually did. Unfortunately for Plagueis, he taught his apprentice all he knew and then his apprentice killed him in his sleep. (The Sith apprentice in the story, as implied by the film and explicitly stated in various Expanded Universe sources, is Palpatine himself). Palpatine notes the irony of how Plagueis could keep others from dying, but not himself. When Anakin asks if it is possible to learn the power to stop death, Palpatine simply replies, "Not from a Jedi," further alienating Anakin from the Jedi Order.
Later, in a meeting with the Jedi Council, Anakin relays the information about Grievous, explaining that a partial message was intercepted in a diplomatic packet from the Chairman of Utapau. Yoda says they should act quickly and decisively on this information. When Anakin expresses his interest in going at Palpatine's request, Mace Windu harshly tells him that the Council will decide who goes and not the Chancellor. Yoda believes that a Master with more experience is needed to confront, and defeat, Grievous. Ki-Adi-Mundi agrees and nominates Obi-Wan to go. With the nomination agreed on, the Council adjourns and Obi-Wan prepares to go to Utapau.
Anakin walks Obi-Wan to his star destroyer before he leaves. Anakin still believes he'd be needed on Utapau, and while Obi-Wan agrees, he also notes it might just be a wild Bantha chase. Anakin stops Obi-Wan and tells him that he knows he's disappointed Obi-Wan and that he's not been acting very grateful for the training he received. Anakin tells him he's just been so frustrated with the Council lately, but that he does apologize. Obi-Wan calls Anakin strong and wise and tells Anakin he's very proud of him and while Obi-Wan trained him since Anakin was a boy, he calls Anakin a far greater Jedi than Obi-Wan could hope to be. But Obi-Wan encourages Anakin to be patient and that it won't be long before the Council makes Anakin a Jedi Master. The two bid each other farewell and Obi-Wan leaves for Utapau. Little do they know that this is the last time they'll see each other as fellow Jedi and friends...
Obi-Wan arrives in Pau City on Utapau, and begins his search for General Grievous, riding a varactyl named Boga. He finds Grievous on the Tenth Level, and the two engage in personal combat, with Grievous using four lightsabers at once. Obi-Wan quickly cuts off two of the General's hands, helping to even out the odds a little. During the battle, the Third Systems Army arrives under the command of CC-2224 (Cody). Obi-Wan manages to catch Grievous off guard and uses the Force to push the fiendish droid general into the ceiling. Grievous drops his remaining two lightsabers and attempts to flee on his wheel bike, while Obi-Wan pursues on Boga. During the chase, Obi-Wan drops his lightsaber, which Commander Cody happens to find during the fighting.
On Coruscant, Anakin tells Palpatine that General Grievous has been found on Utapau. Anakin insists he should be on Utapau as well. Their conversation shifts to Palpatine's knowledge of the Force, and it is revealed that he is the Sith Lord, Darth Sidious. Upon realizing this, Anakin ignites his lightsaber and threatens to kill Palpatine, but then decides to expose him to the Jedi Council. He is still concerned with saving his wife, and believes only Palpatine's knowledge, learned from the late Darth Plagueis, will ensure this.
Obi-Wan continues to chase General Grievous on Utapau. He catches up with the General, and jumps onto his wheel bike. Using Grievous's electrostaff, he manages to destabilize the speeder, and it goes into a spin. Both Obi-Wan and Grievous are thrown off as the speeder topples over the edge of Grievous's secret landing platform. Grievous then draws his Grievance Striker blaster, though it is knocked from his hand by Obi-Wan, now wielding the electrostaff. He knocks Grievous down, and a brawl ensues, during which Kenobi tears open the General's stomach plates, revealing his living organs. Enraged, Grievous picks up the helpless Jedi and throws him over the edge. Obi-Wan manages to hang on, and uses the Force to retrieve the General's blaster, and fires at Grievous's organs. He hits, and they burst into flames. Grievous falls to the floor, dead.
Anakin returns to the Jedi Temple and approaches Mace Windu, who tells Anakin that they have just been informed that Obi-Wan has destroyed General Grievous and so they are going to go to the Senate to ensure that Chancellor Palpatine gives back his emergency powers. But Anakin stops Windu and tells him that Palpatine won't give up his power. Anakin tells Mace that he's learned a terrible truth and that he thinks that Palpatine is a Sith Lord, a statement which shocks Mace and stops him dead in his tracks. Anakin confirms what he just said and says he believes Palpatine is the one they have been looking for. When Mace asks how Anakin knows this, he tells Mace that Palpatine knows the ways of the Force and has been trained to use the dark side and that he is absolutely sure. Mace says their worst fears have now been realized and that if the Jedi Order is to survive, they must move quickly. Anakin warns Windu that Palpatine is very powerful and they'll need his help to arrest Palpatine, but Windu urges him to stay out of it as he senses much fear in Anakin and it could cloud his judgment. Mace says that if what Anakin says is true then Anakin will have gained his trust but for now, he wants Anakin to wait in the Council Chambers till he returns. Masters Windu, Fisto, Kolar, and Tiin board a gunship and head to Palpatine's office.
Sitting in the Council Chambers, remembering Palpatine's promise of stopping death and the dreams of Padmé dying in childbirth, Anakin ruminates over his decision. Finally, he leaves and rushes after the four Jedi.
Mace Windu and the three other Jedi Masters arrive at Chancellor Palpatine's office and declare their intent to have the Chancellor arrested in the name of the Republic. Palpatine screams in rage, pulling a lightsaber out of his sleeve and lunging towards the Jedi. Agen Kolar is distracted and gets stabbed through his stomach. Almost immediately Palpatine turns and slices Saesee Tiin's torso, and a few seconds later, with more effort from Sidious, followed by Kit Fisto, killed by a slash across the gut. Only Mace Windu remains, alone against the Dark Lord.
Palpatine and Mace continue the fight, leading out of the Chancellor's antechamber and into the office proper. Meanwhile, Anakin arrives at the scene just as Windu disarms Palpatine, both combatants balancing on the edge of the large window shattered during the duel. As Mace threatens Palpatine, the Sith unleashes a torrent of Force lightning. However, Mace deflects it with his blade, casting much of the energy back into Palpatine's body. He becomes disfigured and ends his assault, claiming he is too weak to fight. As Mace is deciding to make the choice to kill Palpatine, Anakin enters, and claims Palpatine must stand trial. Anakin is finally forced to choose between the Jedi Order or Padmé. As Mace is about to deliver the killing blow, Anakin makes his choice, intervenes and cuts off Mace's hand. Palpatine, cackling with glee, blasts the shocked Mace out of the window, and to his death hundreds of stories below.
Anakin is horrified by his actions, yet he knows now there is no turning back. He pledges allegiance to Palpatine, in return for the Dark Lord's power. Palpatine takes Anakin as his Sith apprentice, bestowing upon him the Sith name Darth Vader. Palpatine then gives Vader his first assignment: to launch an assault on the Jedi Temple, ensuring the so-called Jedi Rebellion is squashed.
Vader invades the Temple at the head of the 501st Legion. Vader brutally makes his way through the Temple, striking down every Jedi that crosses his path, including swordsmaster Cin Drallig and even a clan of Younglings hiding out in the Council Chamber.
Meanwhile, from his office, Palpatine broadcasts a command to the many clone trooper commanders spread throughout the galaxy; to execute Order 66, an action that effectively sets into motion the Great Jedi Purge and the Galactic Civil War.
Across the galaxy, clone troopers turn against their Jedi Generals. As this happens, Yoda feels everyone who is dying, literally. On Utapau, Obi-Wan Kenobi is flung off a cliff by a blast from an All Terrain Tactical Enforcer but Boga is killed; on Mygeeto, Jedi Master Ki-Adi-Mundi is gunned down by CC-1138 and the Galactic Marines; on the lush, tropical planet of Felucia, Jedi Knight Aayla Secura is slain by CC-5052 and his 327th Star Corps; on Cato Neimoidia, Plo Koon's Jedi starfighter is shot down upon by ARC-170 starfighters, sending it smashing into a clone staging area; and on Saleucami, Stass Allie's 74-Z speeder bike is destroyed by CC-8826 and his wingman, riding BARC speeders. On Kashyyyk, Yoda is overlooking the ongoing battle as Commander Gree receives the order. He and his lieutenant attempt to sneak up to Yoda, but the aged Master senses their deceit and beheads both clones with a slash of his lightsaber.
Senator Bail Organa arrives at the flaming Temple to witness the slaughter of a young Padawan named Zett Jukassa, by a squad of troopers led by Commander Appo. Organa, horrified, flees the scene and departs Coruscant in Tantive IV, in an attempt to make contact with any surviving Jedi.
Both Obi-Wan and Yoda survive Order 66, and are picked up by Senator Organa, having evaded pursuit. The Jedi decide to return to Coruscant to recalibrate the Jedi beacon calling for all Jedi to return to Coruscant, and into Palpatine's trap. Instead, Kenobi hopes to warn any surviving Jedi to stay away from the Temple.
Following the raid on the Jedi Temple, Vader returns to Padmé at the Senate Apartment Complex, from where the smoke rising from the wrecked Temple can be seen. He tells her the Jedi have tried to take over the Republic, and there are traitors in the Senate. He asks for her loyalty to the Chancellor, then tells her that he will go to the Mustafar system, where the remaining Separatists have gathered, to end the war.
On Mustafar, Vader is greeted by Trade Federation Viceroy Nute Gunray, but quickly begins his slaughter of the Separatist Council, trapping them in their own fortified bunker. He leaves Gunray until last, slicing the Neimoidian across the chest even as he pleads for his life. It is at this point that the first physical manifestation of the dark side in Vader begins to show itself, as his irises turn a pallid yellow, the rest of his eye taking on a bright crimson hue.
The Senate holds a special session where Palpatine tells them of the "plot of the Jedi to overthrow the Senate," but that it was foiled. Amidst thunderous applause, he informs the Senate that the surviving Jedi will be hunted down and defeated. He then states that in order to insure the security and continued stability that the Republic will be reorganized into the first Galactic Empire, which Palpatine describes as creating a safe and secure society. As the majority of the Senate screams their approval, Padmé Amidala and Bail Organa, who are shocked at the result, simply look around and Padmé can only remark "So this is how liberty dies, with thunderous applause."
In the meantime, Obi-Wan and Yoda go to the Jedi Temple, slaying clone troopers and walking in disbelief through the carnage. They recalibrate the Temple's signal to warn all Jedi to keep away from the Temple. At the Temple's control center, Obi-Wan looks into the security recordings. In disbelief, he watches Vader's slaughter of the Jedi. Yoda says they have no choice but to destroy the Sith; including Vader. Obi-Wan begs Yoda to let him take the Emperor; however, Yoda refuses, stating that Obi-Wan cannot win that fight; that Obi-Wan must instead fight his former apprentice; his "brother".
Obi-Wan, seeking information on Anakin's whereabouts, arrives at Padmé's apartment. He meets Padmé and tells her that Anakin has turned to the dark side and killed the Younglings in the Jedi Temple. Despite her anguish, Padmé will not reveal where her husband has gone. Obi-Wan leaves, though not before expressing his regret to Padmé, whom he knows is carrying Anakin's child.
Later, Padmé leaves Coruscant in her star skiff, departing for Mustafar to find her husband, and the truth. Unknown to her, Obi-Wan secretly boards the ship just before it takes off.
The star skiff lands on Mustafar, and Padmé is greeted by a smiling Vader. Padmé reveals her conversation with Obi-Wan. When she begs him to run away with her to raise their child in peace, though Vader tells Padmé that he has brought peace to the Republic, and he can overthrow Palpatine so the two of them can rule the galaxy together. Backing away in horror and sorrow, Padmé tells him he is breaking her heart and he is going down a path she cannot follow.
Vader sees Obi-Wan emerge from the star skiff. Enraged, he Force chokes his wife, thinking she brought his former Master to kill him. She loses consciousness, and Vader releases his grip on her, effectively defeating her. Obi-Wan and Vader break out into a ferocious duel.
In the Chancellor's holding office within the Senate Building, Yoda confronts Darth Sidious. They engage in an intense battle using their Force abilities. The duel brings them to the Grand Convocation Chamber, the heart of the Senate. Sidious hurls Senate pods at Yoda, and the effort to avoid them exhausts the Jedi Master. Sidious then blasts Yoda with Force Lightning, but with the last of his strength the Jedi master repels it enough to send both himself and Sidious over the pod's edge. Palpatine was able to hold on to a senate pod, while Yoda fell to the senate floor leaving only his cloak. With Bail Organa's help, Yoda flees the Senate Building, intending to go into exile.
The epic duel between Obi-Wan and Vader leads them through the Separatist stronghold on Mustafar. A missed slash from Vader's lightsaber damages a computer console, resulting in the deactivation of the bunker's shields. The duel continues as the entire facility is bombarded by lava, and both combatants ride down a lava river atop a collection arm severed from the main structure. Kenobi and Vader leap from the arm and continue their intense duel atop floating platforms.
Though on the defensive throughout the fight, Obi-Wan eventually gains the high ground by leaping to the safety of a black sand bank, and in doing so, the upper-hand. Obi-Wan warns Vader that he now holds an unassailable position, but Vader, enraged and bloodthirsty, shouts, "You underestimate my power!", and foolishly leaps up to meet his old Master. In the blink of an eye, Obi-Wan performs a lightning-fast mou kei maneuver, severing Vader's left arm and both of his legs at the knees. Vader tumbles down the embankment and rolls to a stop at the edge of the river of lava. Obi-Wan tells Anakin that he was like a brother to him and that he loved him. His proximity to the molten river causes Anakin to burst into flames. He suffers massive, scarring burns that mangle his physical features.
Obi-Wan takes Anakin’s lightsaber and leaves with the badly-injured Padme and the droids on the Naboo Skiff.
Darth Sidious arrives at Mustafar with a battalion of Clone Stormtroopers. They rescue Anakin Skywalker from the edge of death.
On the isolated asteroid of Polis Massa, Yoda meditates and hears the spirit voice of Qui-Gon Jinn. The voice tells him that there is a way to merge with the Force and retain consciousness after death. In order to learn this power, Yoda declares himself an apprentice of the spirit of Qui-Gon Jinn.
Obi-Wan arrives at Polis Massa and Padme is brought to medical assistance. She is dying, but they work to save her babies—she has twins. A boy and a girl are born. In her dying breath, Padme gives them the names “Luke” and “Leia”.
Occurring simultaneously with the birth of his children, Anakin completes his transformation into Darth Vader. On Coruscant, Anakin is given new legs and a new arm. He is dressed in black armor, a face mask is sealed tightly, and his helmet is fitted. Darth Vader begins to breathe.
With Padme’s last breath, she says there is still good in Anakin. Padme Amidala dies.
Vader is raised to a standing position at the EmPal SuRecon Center, his surgery complete. Vader begins to speak through his voice amplifier to Darth Sidious, asking about Padmé. Darth Sidious, seeking to cut Vader's last tie to his old life and permanently cement the Dark Side in his heart, lies to Vader, telling him that he accidentally killed his wife while Force Choking her on the landing dock. His last shred of hope and love now gone, Vader cries "Nooo!", and unleashes a powerful involuntary Force Scream of rage, shame, and grief, shattering the droids and equipment.
Onboard Tantive IV, docked at Naboo, Obi-Wan, Yoda, and Bail Organa sit at a conference table. They agree to keep Padmé appearing pregnant, thus faking the children's deaths. For their own safety, Luke and Leia will be split up in hopes that the Sith would not sense their presence. Leia will be adopted by Bail Organa and Luke would be sent to his father's step family on Tatooine. Obi-Wan and Yoda will watch and wait until the time is ready for the Skywalker children to do their part. Yoda tells Obi-Wan to study the technique Qui-Gon learned to achieve immortality.
Bail Organa leaves R2-D2 and C-3PO in the care of Captain Raymus Antilles of the Tantive IV. He orders a memory wipe of the talkative protocol droid.
On Naboo, Padmé's funeral takes place in a solemn ceremony in Theed. Her hands clasp the japor snippet given to her by Anakin following his departure from Tatooine some thirteen years previous. To protect her children, her body appears to still be pregnant.
Yoda heads to Dagobah to begin his self-imposed exile, which he partly owes as penance for his failure to defeat Sidious.
On the bridge of a gray-hulled Venator-class Star Destroyer, Vader, the Emperor, and Governor Wilhuff Tarkin oversee the construction of a certain moon-sized battle station.
On Alderaan, the infant Leia is brought by Bail Organa to his wife, Queen Breha.
On Tatooine, Obi-Wan brings Luke Skywalker to his new family: his uncle, Owen, and his aunt, Beru. Obi-Wan leaves on an eopie, heading to his exile in the Jundland Wastes. Owen and Beru, holding the infant Luke, look out to the horizon and watch the setting of Tatooine's twin suns.