Man of Steel received a lot of criticism from fans for its ending involving Superman (Henry Cavill) and General Zod (Michael Shannon), but one of the film's writers is defending it.

Ben Affleck Says Gal Gadot Is 'Incredible' As Wonder Woman

Fans will remember that Superman killed General Zod in the final battle in Metropolis, which goes against the honorable superhero's general code.

One of the film's writers, David S. Goyer, took to the Nerdist podcast this week and revealed why this had to happen.

How Will Ben Affleck's Batman Differ From Christian Bale's Portrayal?

"You have to do what's right for the story," Goyer explained. "In that instance, this was a Superman who had only been Superman for like, a week. He wasn't Superman as we think of him in the DC Comics...If you take Superman out of it, what's the right way to tell that story?...The moral, horrible situation to be in is to actually be forced to kill, not wanting to, the only other person from your race. Take Superman aside, I think that's the right way to tell that story."

This decision will have huge ramifications in the highly anticipated Batman v Superman: Dawn of Justice. One of Bruce Wayne's (Ben Affleck) buildings goes down in the Metropolis battle, and he comes to resent Superman for what he's done.

"What happens there is one of Bruce [Wayne]'s buildings gets destroyed and he's trying to save all the people inside the building and he can't," Cavill explained to Total Film recently. "So he is this angry person who fears what Superman may do. Why are they just going to trust this super-powered alien? What if he does decide to turn against us?"

Batman v Superman: Dawn of Justice is scheduled for release in theaters March 25, 2016.