The film is loosely based on the 1982 X-Men graphic novel God Loves, Man Kills. In the film, William Stryker is a high-ranking army colonel who leads an assault into Professor Xavier's school to build his own version of Xavier's mutant-tracking computer Cerebro in order to destroy every mutant on Earth. The X-Men are forced to ally with Magneto and Mystique to defeat Stryker. X2: X-Men United, which introduced Nightcrawler to filmgoers, surpassed the initial film at the box office, earning approx. $215 million in North America compared to $157.3 million for X-Men, making the sequel one of the top ten movies of 2003.
The basic story elements, involving Stryker's plot to use Xavier's powers against all mutants, and the X-Men's resulting alliance with Magneto, are loosely adapted from the graphic novel God Loves, Man Kills by Chris Claremont. In that story, Stryker has a military background, but is currently a religious leader whose wife gave birth to an obviously mutant infant. In a fit of rage, he killed them both and decided that he had been chosen by God to destroy mutants. In the film, his military background is moved to the foreground, and the religious aspect of the character is eliminated. Instead of killing his wife and son in childbirth, the Stryker of the film sends his son (loosely based on the character Mastermind from the comics) to Xavier to be cured of his mutation. Unable to change his mutation, and resentful of his parents, he began tormenting his mother by projecting nightmarish images into her mind, causing her to commit suicide by drilling a hole into her head. Stryker responded by giving his son a lobotomy, and extracting his brain fluid, which he now uses to control other mutants.
Bryan Singer credited The Empire Strikes Back and The Wrath of Khan as his influences on this film. The latter film also features a voice-over at the end from a dead character, hinting at their resurrection in the next film.