*Warning: This story includes spoilers for Avengers: Endgame*

Following the devastating conclusion of Avengers: Infinity War, all eyes were on the creative team behind the franchise to develop a satisfying way to reclaim the Infinity Stones and resurrect the fallen heroes in Avengers: Endgame. This week, Endgame screenwriters Christopher Markus and Stephen McFeely explained part of their creative process in developing this plot device, offering one unexpected influence: the Harry Potter series.

In the film, the surviving Avengers use Ant-Man’s Quantum Realm technology to travel back in time and acquire the past versions of the Infinity Stones, meaning that Markus and McFeely had to develop their own time travel rules. Per ComicBook.com, the co-writers researched time travel films including Back to the Future, but ultimately concluded that its rules wouldn't fit.

“Everyone thinks that's how time travel works, because that's a great movie, maybe the best of its subject,” McFeely said. “But if we were to do that, to do something in the past and it would screw up your future, we're gonna do that six times. We would have no way to follow that.”

Instead, they drew inspiration from the rules of Harry Potter and the Prisoner of Azkaban, which includes a time travel mechanism in the form of the Time-Turners. "I do love that third Harry Potter movie, where a stone will break a vase, and you won't know why, but the scene's fine and it doesn't take you out of it," McFeely explained. "Then when you come back around [during the time travel sequence] and you realize that they had thrown it at themselves."

Like Prisoner of Azkaban, Endgame sees its protagonists actively interacting with the past, with some characters even meeting their past selves, and paradoxes from the time travel sequence—such as Thanos’s past self dying in the future—being left unresolved.

[h/t ComicBook.com]