WARNING: The following article contains major spoilers for Avengers: Endgame, in theaters now.

Avengers: Endgame wastes no time once the surviving heroes of the Marvel Cinematic Universe regroup, tracking down Thanos to a faraway planet in a desperate bid to acquire the Infinity Gauntlet and restore half of all life in the universe. However, this early mission proves futile, as it's revealed the Mad Titan destroyed the Infinity Stones after his work was done. A frustrated Thor then kills the villain on the spot.

For screenwriters Christopher McFeely and Stephen Markus, this early death of the main villain, who possessed a fully-powered Infinity Gauntlet at the time, presented a creative challenge while scripting the film.

RELATED: Chris Pratt Shares His Illegal Avengers: Endgame BTS Video

"We always had this problem. The guy has the ultimate weapon. He can see it coming," admitted McFeely in an interview with The New York Times. "We were just banging our heads for weeks, and at some point, [the executive producer] Trinh Tran went, 'Can’t we just kill him?' And we all went, 'What happens if you just kill him? Why would you kill him? Why would he let you kill him?'”

Ultimately, the villain would not resist the heroes' arrival, having accomplished his mission to wipe out half of all life in the universe. And with the gauntlet now completely useless, Thanos would die believing his vision would be irreversible .

RELATED: Avengers 4: The Best MCU Callbacks & Easter Eggs

"It reinforced Thanos’s agenda. He was done," elaborated Markus. "Not to make him too Christ-like, but it was like, 'If I’ve got to die, I can die now.'”

Directed by Joe and Anthony Russo, Avengers: Endgame stars Robert Downey Jr. as Iron Man, Chris Evans as Captain America, Mark Ruffalo as Bruce Banner, Chris Hemsworth as Thor, Scarlett Johansson as Black Widow, Jeremy Renner as Hawkeye, Brie Larson as Captain Marvel, Paul Rudd as Ant-Man, Don Cheadle as War Machine, Karen Gillan as Nebula, Danai Gurira as Okoye and Bradley Cooper as Rocket, with Gwyneth Paltrow Pepper Potts, Jon Favreau as Happy Hogan, Benedict Wong as Wong, Tessa Thompson as Valkyrie and Josh Brolin as Thanos.