Robert Redford comes out of retirement for a strategic cameo in (spoiler alert!) ‘Avengers: Endgame’

(Photo courtesy Disney / Marvel Studios) Robert Redford portrays Secretary Alexander Pierce, head of the global group that oversees Nick Fury's S.H.I.E.L.D. in the 2014 Marvel Studios movie "Captain America: The Winter Soldier."

[Warning: Spoilers ahead. Do not read this article if you haven’t seen “Avengers: Endgame” and still want to go into the movie without knowing its secrets.]

Robert Redford’s retirement from movie acting lasted about six months, thanks to the Marvel Cinematic Universe.

The actor, director, producer and founder of the Utah-based Sundance Institute told The Salt Lake Tribune last fall that he was “pretty committed to retiring from acting” and “moving into new territory as a director and producer.” His starring role in the heist comedy “The Old Man and the Gun,” which opened in theaters in October and earned Redford a Golden Globe nomination, was touted as his last movie role.

But, as the millions of moviegoers who saw Marvel’s “Avengers: Endgame” over the weekend learned, the 82-year-old Redford had one more movie performance in him.

Without getting into too many spoilers, “Avengers: Endgame” takes its superheroes on a trip through time to collect the six Infinity Stones needed to undo the damage the villain Thanos did at the end of last year’s “Avengers: Infinity War.” Specifically, our heroes have to go back into their own histories, reprising moments from past Marvel movies and meeting old characters from the franchise.

In one scene, set just after the Avengers saved New York in “The Avengers” (2012), Redford pops up in “Endgame” in the lobby of Stark Tower. He’s reprising the character of Secretary Alexander Pierce, last seen in “Captain America: The Winter Soldier” (2014) — the head of the global group that oversees Nick Fury’s S.H.I.E.L.D., and, oh yeah, the top operative for the evil organization Hydra. (Yes, that’s a spoiler for those who haven’t seen “The Winter Soldier.” But it’s been five years, and there’s got to be a statute of limitations on this, doesn’t there?)

Redford joined a long list of actors who have appeared in Marvel movies and came back for the time-travel sequences of “Endgame.” They include Rene Russo (as Thor’s mom, Frigga), Tilda Swinton (as Doctor Strange’s mentor, The Ancient One), Michael Douglas (as the original Ant-Man, Hank Pym) and John Slattery (as Howard Stark, father of “Iron Man” Tony Stark).

“Avengers: Endgame” shattered box-office records in its opening weekend. According to the movie numbers site Box Office Mojo, the movie grossed $357.1 million in North America between Thursday night and Sunday, and a global haul of $1.2 billion.

Redford did give himself an out on retirement. In his interview last fall, he said he might consider returning to a movie set “if something came along and was really powerful.” It seems the Avengers are about as powerful as movies can get.