The following post contains SPOILERS for Spider-Man: Far From Home.

I don’t think Spider-Man: Far From Home is the best Spider-Man movie, but it might have the best and most shocking ending. Spidey defeats Mysterio, wins the heart of MJ, and swings triumphantly through New York City — when Mysterio reveals his secret identity to the entire world via a manipulated video that is published by J. Jonah Jameson, played by a returning J.K. Simmons. It’s maybe the two biggest surprises in Marvel movie history, and they’re both in a single scene.

According to Far From Home writers Chris McKenna and Erik Sommers, though, that was not always the intended ending. In an interview with The New York Times, they said that at one point, the film ended with Peter Parker intentionally revealing his secret identity in order to defeat Mysterio. Here’s more, from McKenna:

We were wondering, ‘Are we going as deep as we need to at the end of the movie?’ We played with the idea that Peter is the one who sacrifices his identity out of necessity during the final battle, then it seemed more interesting if Mysterio tricks him into doing it, but any time we wrote a version where he was being revealed to the world in that battle, it felt like it diminished the victory. So before it became a tag, it was really just the end of the movie: Right as he feels he’s stepping up as Spider-Man, he has the rug pulled out from under him again.

Sommers added that they had also considered whether they should frame Spider-Man for a crime or just turn him into a pariah and ultimately decided “both was the way to go.” It’s certainly an unforgettable moment. There’s more interesting info about the production in the Times interview, so be sure to check that out.

McKenna and Sommers didn’t specify how or why they would have wanted Peter to intentionally reveal his identity to defeat Mysterio, so it’s tough to compare it to the ending we did get. The final ending, though, works great, especially in a big crowd of longtime fans who can fully appreciate the gravity of that moment coming from Simmons as J. Jonah Jameson. And given all the parallels between Peter Parker and Tony Stark in these movies, it’s a perfect inversion of the end of Iron Man 1 to have Far From Home with Peter Parker’s big “I am Spider-Man!” scene, only it’s completely against his will. I loved that.

Spider-Man: Far From Home is in theaters now.

Gallery — Every Spider-Man Movie Ranked:

More From K92.3