WARNING: The following contains spoilers for Avengers: Infinity War, which is in theaters now.


Avengers: Infinity War's emotional ending may have come as a shock to fans all over the world, but according to Infinity War screenwriters Christopher Markus and Stephen McFeely, Marvel Studios President Kevin Feige was behind the decision right from the get-go.

In an interview with The Hollywood Reporter, McFeely revealed that Feige was very supportive of their decision to let Thanos have his way. "From the very beginning, Kevin said, 'Don't be afraid of that move. It's OK to go there, and let's go there,'" McFeely said.

RELATED: Avengers: Infinity War Cast Asks ‘Where Were Ant-Man and the Wasp?’

The ending of Infinity War sees Thanos perform the dreaded snap of his fingers after Thor drives Stormbreaker through his chestplate. With that fateful snap, the Mad Titan completes his goal to wipe out half of civilization in the universe, culminating in the deaths of many beloved characters. The snap occurred much earlier in Jim Starlin's 1992 comic series, The Infinity Gauntlet, happening in the first issue.

McFeely and Markus took great care in deciding where in the story the monumental, though physically minute, action would take place. "The question was, 'How do you get there?'" McFeely said. "'How do you bring the most story and emotion and pathos?' And was it going to be where it was? Do you do it at the end of the movie? Do you do it at some other spot?"

RELATED: Avengers: Infinity War’s Marketing Lied to Us — and That’s Just Fine

"There are still questions," Markus said. "What are they [The Avengers] going to do, and all those sorts of things. But if you had stopped it before he snapped his fingers, or with four stones, that really is just a pause button. That really is just going, 'What's he going to do?' 'Will your hero stop dangling from the cliff?' And we wanted to put a much more definitive 'Yes, this happens. Deal with it,' tone at the end of it, rather than jerk you around."

In theaters nows, Avengers: Infinity War is directed by Joe and Anthony Russo and stars Robert Downey Jr., Chris Evans, Chris Hemsworth, Mark Ruffalo, Jeremy Renner, Scarlett Johansson, Paul Bettany, Anthony Mackie, Paul Rudd, Elizabeth Olsen, Tom Holland, Benedict Cumberbatch, Chadwick Boseman, Chris Pratt, Zoe Saldana, Dave Bautista, Bradley Cooper, Vin Diesel, Tom Hiddleston and Josh Brolin, among others.