Captain Marvel's fight with Thanos was a last-minute addition to Avengers: Endgame.

Speaking to SlashFilm, film editor Jeff Ford explained how Carol Danvers' moment in the film's climactic battle evolved. "When Captain Marvel arrives, that was in the script from day one, the way she comes through the ship," he revealed. "We knew she was going to do that, but what we did alter and add and expand later, mostly because of how much we loved what Brie [Larson] was doing with the character, was her fight with Thanos before he power punches her back."

RELATED: Endgame Writers Explain Exactly Why the Female Avengers Moment Works

"Anthony [Russo] came up with the great idea -- this was a reshoot, by the way, at the last minute -- he had the great idea that Thanos pulls the power stone out of the gauntlet, and then he punches her with the raw power stone," he continued. "That is a fantastic use of that prop and that story point, because that’s what you want. And we had to find a way that he could sideline Captain Marvel for a minute, because she’s so powerful, there’s no way to do it."

In March, Brie Larson revealed that she began filming Endgame before exploring the character fully in Captain Marvel, which was released months before the Avengers film. This explains some of the last-minute changes to her screen time, as both she and the filmmakers became more acquainted with the character.

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. The film is available on Digital HD, Blu-ray and 4K UHD.

KEEP READING: Avengers: Endgame Writers Reveal Secret Ingredients to MCU Movies