Jake Gyllenhaal on almost playing Spider-Man and what he learned from 'Prince of Persia'

Jake Gyllenhaal enters the Marvel Cinematic Universe next week with the release of Spider-Man: Far From Home, in which he plays Quentin Beck – aka Mysterio – a flying, dome-helmet-wearing supes who becomes a mentor to Tom Holland's Peter Parker in the film's early goings.

There was a time, though, some 15 years ago, when the now-38-year-old actor almost played Spidey himself. He was rumored to be in the running to take over the role of Parker in 2004's Spider-Man 2 after star Tobey Maguire injured himself on the set of the horseracing drama Seabiscuit. Gyllenhaal was also dating Spider-Man's lead female, Kirsten Dunst, at the time.

"I heard the same thing," Gyllenhaal said coyly when we recalled as much during a recent interview in Yahoo Studios (watch above). "The truth of the matter is, in the end, he's Spider-Man."

It was typical Hollywood maneuvering, the Gyllenhaal explained. "There are so many roles in my career where I was up against another actor, or something happened that possibly could've happened but didn't happen but maybe it would have… Eventually my belief is when an actor's played a character, particularly in a movie, the character's theirs, and that's that.

"But yeah he hurt himself and there was talk. And there was a slew of actors [possibly up for the part], and I was one of them."

Far From Home marks Gyllenhaal's first mega-budgeted studio entry since the 2010 video game adaptation The Prince of Persia, which turned a profit with a $336 million haul but never became the franchise successor to Pirates of the Caribbean that Disney hoped it could be. The actor has done nothing but original adult dramas since (including but not limited to Source Code, End of Watch, Prisoners, Nightcrawler, Nocturnal Animals and Velvet Buzzsaw), many of which drew serious acclaim, and it's long been speculated that generally underwhelming reaction to Persia turned him off blockbuster fare.

Gyllenhaal all but confirmed that was the case.

"I think I learned a lot from that movie in that I spend a lot of time trying to be very thoughtful about the roles that I pick and why I'm picking them," he said. "And you're bound to slip up and be like, 'That wasn't right for me,' or 'That didn't fit perfectly.' There have been a number of roles like that. And then a number of roles that do."

Spider-Man: Far From Home opens July 2. Visit Fandango for tickets and showtimes information.

Watch the trailer:

Read more on Yahoo Entertainment:

Want daily pop culture news delivered to your inbox? Sign up here for Yahoo Entertainment & Lifestyle's newsletter.