Chris Evans, left, and Robert Downey Jr. speak onstage Tuesday during the premiere of "Avengers: Endgame" in Los Angeles. (Jesse Grant/Getty Images for Disney)

[Warning: Some spoilers to “Avengers: Endgame” are revealed in this piece. Please read with care.]

When Robert Downey Jr. and Marvel got together to shoot “Iron Man” in 2007, the two could have been looking in the mirror. They were both down and out and in need of redemption.

Downey was well removed from his wunderkind years of “Less Than Zero” and “Chaplin” after a series of tabloid scandals. Marvel was undertaking the risky launch of a studio without its biggest characters (“Spider-Man” and “X-Men” were licensed to other studios), forcing it to go with the lesser-known Tony Stark.

No one thought Iron Man could be an A-list superhero. And no one thought Downey could be an A-list star.

Eleven years, later, practically to the weekend, Downey and “Iron Man” have overturned both assumptions. Pundits who questioned the idea of a blockbuster with a forgotten character and a washed-up actor have been forced to eat crow, many helpings of it.

All of eight of Downey’s films have been smashes, a feat of bankability that few franchise actors have achieved. Downey’s Marvel Cinematic Universe films have grossed $9.45 billion worldwide. The eight Harry Potter movies, starring Daniel Radcliffe, grossed $7.72 billion..

That number has vaulted well over $10 billion as the ninth Downey Marvel picture, “Avengers: Endgame,” hit theaters this weekend. Downey’s emotional farewell in the movie coincides with an expiring contract and a desire to move on to the next phase of his career. His departure from the series marks a rare event in the movie business — a relationship that is peaking critically and financially as it ends.

“Endgame” grossed an estimated $350 million in North America and $859 million overseas this weekend, easily surpassing the previous opening-weekend records in both categories (held by “Avengers: Infinity War”) by more than 30 percent each. Some analysts believe global total for “Endgame” could eventually surpass the $2.78 billion for “Avatar,” the current record-holder for highest worldwide box office, not adjusting for inflation. It has all been building to this, the Downey-Avengers marriage culminating in the biggest title of the series.

“What I find amazing about this franchise is that they managed to walk the tightrope between becoming just massively bloated and impossible to follow and putting together films that were actually interesting every time,” said Bruce Nash, a movie-industry analyst who runs the box office site The Numbers. “And that has some together into a complete whole at the end.”

And it all could be tracked back to that spring weekend in 2008 when “Iron Man” became a surprise hit with a $98 million U.S. opening that was the second-highest ever for a non-sequel at the time.

As a tarnished star and a cinematically forgotten comic character, Downey and Iron Man seemed a strange pair. But somehow that made them well-suited to each other — the underused film property with the underachieving talent. It didn’t hurt that Downey had the kind of acting skills rarely seen in a superhero movie. Downey’s versatility, his uncanny blend of vulnerability and swagger, helped elevate “Iron Man,” distinguishing it from being just a brand exercise with interchangeable parts.

In contrast to the strong, silent heroes of the age, Downey did it differently. He was smaller, with a quicksilver tongue and sharp wit. He was always on his game. And he projected depth.

The year after “Iron Man,” Disney, seeing the potential for an entire universe of characters, bought Marvel and wisely left studio chief Kevin Feige in place. And Feige continued putting his chips on Downey. The actor, at the time a very un-marquee 44, would nonetheless carry another ”Iron Man” in 2010, and then two years later become the cornerstone of “The Avengers,” the film that managed to be a Downey vehicle and an ensemble powerhouse at the same time.

Modern Hollywood movies are usually a one-way equation for actors. In franchise films, the property makes the actor, not the other way around. The reverse is true for stand-alone and original hits, in which the movie would often be nothing without performers.

But what’s unique about Downey and Iron Man is how the power went in both directions. The property elevated the actor and the actor made the property. Neither could thrive without the other. Try to imagine “Iron Man” or even the Marvel Cinematic Universe (MCU), without Downey.

Actor comebacks are a funny thing. We can’t imagine them until they happen, and then we can’t imagine how they could have gone any other way. “It seems like a thousand years ago. I fought my way out of that cave, became Iron Man, realized I loved you,” Stark says in “Endgame.” One could read that remark addressed as much to the audience as his love interest in the movie.

Downey now understandably wants out, having given the better part of 12 prime acting years to this endeavor. And Disney executives will get the chance to develop fresh new stars and give them their own movies, with the added consolation prize of not having to pay Downey the high back-end profits he gets (and most other actors don’t).

Downey probably will have a next act, picking up on work did both during this time — in dramas like “The Soloist,” in comedies like “Due Date,” in offbeat dramedies like “The Judge” — and before it. The acclaimed work will go on. (Of course, it’s never wise to rule out MCU appearances in alternate timelines, flashbacks and spectral apparitions).

Nearly five years ago, Downey used a Downey-ish locution while speaking to this reporter, then at the Los Angeles Times, to describe just these ambitions.

“It’s interesting. There’s an opportunity in placing your worth just slightly out of your own skin, and wanting to prolong a projection of what you represent in an industry instead of saying, ‘This too shall pass.’ But my biological clock is running the show. I’m turning 50 next year, and maybe there’s a few more in me. [But] time is the only nonnegotiable integer.”

So now that wheel turns. The MCU can certainly go on very profitably without Downey; the past 18 months have brought the minting of new stars such as Chadwick Boseman’s Black Panther and Brie Larson’s Captain Marvel, putting the baton in highly commercial hands. Someday years from now we will recall the way they landed on the scene, recounted the years of hit films they then made, wonder how they could now leave. The fresh face will become the fatherly sage. Time moves on. Only movies such as “Endgame” can transcend it.