The opening crawl reveals that the galaxy is in the midst of the war. Chancellor Palpatine (Ian McDiarmid) has been kidnapped by the Separatists' second-in-command, General Grievous. Jedi Knight Anakin Skywalker (Hayden Christensen) and Jedi Master Obi-Wan Kenobi (Ewan McGregor) lead a mission to rescue him. After killing Count Dooku (Christopher Lee) and freeing the Chancellor, the Jedi attempt to escape, but are captured by General Grievous. Anakin and Obi-Wan manage to break free, but Grievous escapes and traps the Jedi and the Chancellor inside the severely damaged cruiser. Anakin is forced to crash-land the ship on one of Coruscant's landing tracks.
Upon his return, Anakin is reunited with his wife, Padmé Amidala (Natalie Portman), who tells him that she is pregnant. Despite Padmé's worries over their secret marriage, Anakin is overjoyed at this news, and the couple makes plans to raise their child. However, Anakin is troubled by visions of Padmé dying in childbirth, visions similar to those he had of his mother just before she died. Later, Obi-Wan privately tells Anakin that the Council wants him to spy on the Chancellor because they believe him to be corrupt, an order Anakin resents since the Chancellor has become a mentor to him. As the Chancellor's bodyguard, Anakin develops a close friendship with Palpatine, who subtly manipulates Anakin in their discussions, making him distrust the Jedi. Palpatine claims to know of an ability to prevent death.
Obi-Wan is sent to Utapau, where he engages and kills General Grievous. Meanwhile, back on Coruscant, Palpatine reveals himself to Anakin as the Sith Lord Darth Sidious, who has been controlling the Republic and the Separatist movement. Anakin leaves to expose him to the Jedi Council. Mace Windu (Samuel L. Jackson) arrives at the Chancellor's office shortly thereafter and eventually subdues Palpatine through a lightsaber duel. Just as Anakin arrives, Windu is about to slay the Chancellor. Anakin quickly disarms Windu, believing the Chancellor holds the only way to save his wife. Windu is consumed by Sidious' torrents of force lightning, forcing him out a window and to his death. Darth Sidious takes Anakin as his Sith apprentice and gives him the name Darth Vader. He then orders Vader to kill all Jedi within the Jedi Temple, then to go to the Mustafar system and eliminate the Separatist leaders.
Darth Sidious orders clone troopers across the galaxy to turn against their Jedi Generals by enacting a pre-programmed directive, Order 66. Numerous Jedi across the galaxy are seen being exterminated, although both Yoda and Obi-Wan survive. Darth Vader slaughters all the children in the Jedi Temple. Afterwards, he goes to Padmé and tells her the Jedi have attempted to take over the Republic and leaves for Mustafar, where he slaughters the Separatist leaders. Senator Bail Organa (Jimmy Smits) rescues Obi-Wan and Yoda (Frank Oz), and brings them to the Jedi Temple before heading to the Senate building. Palpatine informs the Senate of a Jedi plot to overthrow the Republic. As a result, he announces that the Republic will be reorganized into the Galactic Empire. In the Jedi Temple, Obi-Wan and Yoda stand in shock over the bodies of the younglings and reconfigure a signal to warn all Jedi to keep away. Obi-Wan looks into the security recordings and, to his horror, sees a hologram of Vader carrying out the orders of Darth Sidious and kneeling to him. Though he initially refuses, Obi-Wan eventually agrees to find and kill Vader, and Yoda decides to fight the Emperor. Obi-Wan then meets with Padmé, who refuses to believe his claims about Anakin's fall to the dark side. When she departs for Mustafar, Obi-Wan secretly stows away onboard.
Obi-Wan Kenobi and Darth Vader fight on Mustafar.When the couple is reunited, Padmé pleads with Vader to leave public life with her, but he refuses, believing that he can overthrow Palpatine so that he and Padmé can rule the galaxy together. Vader sees Obi-Wan emerge from Padmé's ship, and suspects her of betraying him. Enraged, he uses the Force to choke Padmé into unconsciousness. Obi-Wan and Vader break into a vicious lightsaber duel.
Back on Coruscant, Yoda confronts the Emperor, who unleashes force lightning on the ancient Jedi. Yoda, in return, throws the Sith Lord across his Senate office. The two most powerful practitioners of the Force engage in a fierce duel inside the Senate Chamber itself. When it appears that Yoda has the upper hand, Sidious unleashes the Force to the point that Yoda is forced to retreat, and decides that his failure has led him to go into exile. As his troops search for the Jedi, Darth Sidious decides to go to Mustafar saying, "I sense Lord Vader is in danger."
Back on Mustafar, the former Jedi friends are now bitter enemies. The duel brings them out of the facility to unprotected areas of the volcano planet. Obi-Wan eventually gains the advantage of higher ground, and when Vader attempts to attack again, Obi-Wan slices off both of his legs and his left arm in two swift cuts. Vader tumbles down the embankment and rolls to a stop at the edge of the lava. He catches on fire, sustaining near-fatal third-degree burns and severe lung damage. Obi-Wan leaves Mustafar with the hurt Padmé and Anakin's lightsaber. Darth Sidious arrives on Mustafar a short time later and rescues Vader from the brink of death.
Padmé is given medical assistance, and although she is physically intact, her will-to-live is gone. She delivers twins, a boy and a girl and gives them the names "Luke" and "Leia". Just as Padme tells Obi-Wan that there is still good in Anakin, she dies. On Coruscant, Vader's missing limbs and damaged body parts are replaced by cybernetic prostheses and implants. Vader is put into a full suit of black armor and is sealed in a respirator mask, which will allow him to survive his injuries. When Vader asks Sidious about Padmé's condition, he tells Vader that, in his anger, Vader himself killed Padmé. Vader unleashes a furious scream of mournful rage and destroys droids and equipment throughout the room with the Force while Sidious looks on with an evil grin. Aboard the Tantive IV, Obi-Wan, Yoda, and Bail Organa agree to keep the children hidden and separated. Obi-Wan and Yoda will watch and wait until the time is ready for the Skywalker children to do their part in the battle against the Sith. Leia is taken to Alderaan to live with the Queen and Bail Organa, and Luke is transferred to Tatooine to live with Owen and Beru. The film concludes with Owen and Beru holding Luke while staring out over the desert at Tatooine's twin suns.