Xavier and X-Men member Cyclops visit the mutant Magneto in his plastic prison cell inquiring into the assassination attempt. The Professor discovers that a covert government operative, William Stryker, has been extracting information from Magneto. Stryker and his assistant Yuriko Oyama capture Cyclops and Xavier and raid Xavier's school. Wolverine, defending it, kills many of Stryker's men, while Colossus, Rogue, Iceman, Pyro, and most of the students escape via hidden tunnels. Wolverine confronts Stryker, who fails to shed any light on Wolverine's past. Iceman helps Wolverine escape, but Stryker's soldiers succeed in sedating six students and breaking into Cerebro.
Impersonating Senator Robert Kelly and Yuriko, the shape-shifting Mystique gains information about Magneto's prison and helps him escape. She also leans of plans for another Cerebro. Wolverine, Rogue, Iceman, and Pyro visit Iceman's parents in Boston. After a 9-1-1 call from Bobby's jealous brother Ronny, the Boston Police Department arrive just as the group is leaving. Pyro uses his fire-projection power to fend off the police, and Rogue halts him when he begins attacking savagely.
The X-Jet arrives to pick them up, and is targeted by two Air Force fighter jets. Hit by a missile, it does not crash due to the sudden intervention of Magneto. The X-Men reluctantly team up with Magneto and Mystique. At their camp, Mystique unsuccessfully attempts to seduce Logan by taking the form of Jean Grey. Magneto learns that Stryker orchestrated the attack on the president to provide rationale to raid Xavier's school and use an injectable drug to control the mutant students. Jean reads Nightcrawler's mind and determines that Stryker's base is inside the dam at Alkali Lake, where he plans to kill all mutants by via a second Cerebro.
Through his son, Jason, Stryker gains control over Xavier, who is brainwashed to use Cerebro to find and kill mutants. Mystique infiltrates Stryker's base by impersonating Wolverine. Storm and Nightcrawler search for the kidnapped students. Jean, Magneto, and Mystique are attacked by a brainwashed Cyclops while trying to rescue Xavier, and in the process cause damage to the generators that keep the dam from collapsing. The force of Jean's telekinetic blast clashing with Cyclops' optic blast awakens him from his brainwashing, but also cracks the dam. Wolverine finds Stryker in an adamantium smelting room, where he recovers some of his memory. Wolverine fights and defeat Yuriko, then finds Stryker on a landing pad, where Stryker bargain for his life by offering to reveal Wolverine's past.
Storm and Nightcrawler find the students. Magneto and Mystique kill the rest of Stryker's men, and Magneto stops Jason and Xavier before Cerebro kills any mutants. Disguised as Stryker, Mystique uses Jason to convince Xavier to kill all humans; she and Magneto, along with new initiate Pyro, use Stryker's helicopter to escape Alkali Lake, chaining Stryker to concrete rubble. Nightcrawler teleports Storm inside Cerebro, where she creates a snowstorm to free Xavier from his illusion.
The X-Men flee the base as water engulfs it, only to discover that Magneto, Mystique, and Pyro had escaped on the helicopter. Iceman and Rogue arrive with the X-Jet and get everyone on board. The dam bursts, flooding the landscape and killing Stryker. A malfunction aboard the X-Jet prevents it from taking off; Jean sacrifices herself by leaving the jet and creating a telekinetic wall as a shield against the flood. She activates the X-Jet's primary engines before releasing the torrent of water down on herself, presumably killing her.
The X-Men give the President files from Stryker's private offices, and Xavier warns him that humans and mutants must work together to build peace. Back at the school, Xavier, Cyclops, and Wolverine remember Jean. Wolverine tells Cyclops that Jean chose Cyclops over him. Over Alkali Lake, a Phoenix-like shape has formed.