SAN FRANCISCO — John Elway stood on one sideline at California Memorial Stadium, Ron Rivera on the other. Both young men anxiously awaited the final play of the biggest game of their lives.

More than three decades later and an hour’s drive south of Berkeley, where that remarkable sequence of events took place in arguably the most amazing finish to a game in football history, the former star quarterback and linebacker — rivals again in Super Bowl 50 — remember the moment as if it were yesterday.

One man smiles broadly at the recollection of California’s winning touchdown scored in the final seconds amid scattering Stanford band members who had gathered in the south end zone. The other grimaces over what might have been, although the passage of time has eased the anguish.

It is Nov. 20, 1982. Elway, Stanford’s star quarterback, had further cemented his legendary career with the Cardinal by pulling off a remarkable comeback drive to put his team ahead 20-19 in the annual grudge match known as “The Big Game’’ against Rivera’s California Golden Bears.

Elway, now general manager of the AFC champion Denver Broncos, directed his team to the go-ahead field goal with one of his signature drives, the kind that would define his Hall of Fame career in the NFL. The drive was highlighted by his spectacular 29-yard completion on fourth-and-17 from his own 13-yard line. With eight seconds remaining, Elway moved the Cardinal into position for a 35-yard field goal that presumably would decide the game.

So much was on the line for the young quarterback. A win would earn Stanford an invitation to the Hall of Fame Classic bowl game and also would guarantee the Cardinal (5-5 entering the game) a winning record for the only time in Elway’s career. It also might convince Heisman Trophy voters to select Elway over Georgia running back Herschel Walker for the most prestigious individual honor in college football.

advertisement | advertise on newsday

Biggest game of the year

Stanford-Cal was as fierce a rivalry as any in the sport. This was the 85th meeting between the teams, with pride and the famed “Stanford Axe” on the line. The trophy dates to 1899, but both teams decided in 1933, after a series of thefts by students from both schools, that the winner of each year’s game would keep the Axe for the following year. The score of each year’s game is inscribed on a plaque on which the Axe is mounted.

“We hadn’t been to a bowl game, and that was our opportunity to not only get to a bowl game but to have a winning season, so it was very big at the time,” Elway said in an interview with Newsday on Wednesday at the Broncos’ team hotel in Santa Clara, just a few miles from their practice site at Stanford’s football stadium, where Elway once played. “Knowing it was your last [college] game, too, there was a lot of emotion there.”

After Mark Harmon kicked that 35-yard field goal to give Stanford the lead, four seconds remained. Elway thought his dream was about to come true.

Meanwhile, Rivera, now coach of the NFC champion Carolina Panthers, was on the Cal sideline, lamenting what he thought was the missed opportunity to end his junior season with a win over his team’s longstanding rival. He had deep roots in the area, having been born in Fort Ord, California, and having played high school football in Monterey — about two hours south of San Francisco — before earning a scholarship to Cal as one of the country’s top linebacker prospects.

Giants videos

“I was on the sideline, just tremendously disappointed, thinking we had just lost this game,” Rivera told Newsday on Wednesday after his daily Super Bowl news briefing. “That’s a game [against Stanford] that was very important to us.”

And then it happened . . . the most bizarre final play you could ever imagine.

One final play

After Harmon’s field goal, Stanford players stormed the field and the team was penalized for unsportsmanlike conduct. Harmon, kicking off from the 25-yard line, was told to squib the kick. It was down the middle, but short so it wouldn’t reach the regular kick returner, and the ball wound up in the hands of Cal’s Kevin Moen at the Cal 45.

Oddly enough, Moen was one of only 10 Cal players on the field. Confusion on the sideline resulted in the team having one fewer player than allowable.

advertisement | advertise on newsday

After a few steps, Moen lateraled to his left to Richard Rodgers, who gained only 1 yard before looking around for someone else to lateral to. He found Dwight Garner, who caught the ball at the Cal 45. After being surrounded by several Stanford players, Garner’s knee appeared to hit the ground as he was being tackled, but he lateraled back to Rodgers, who then ran upfield.

As he lateraled the ball to Mariet Ford just inside Stanford territory, several members of the Stanford band, which was scheduled to play a postgame concert, began walking onto the field, unaware that the game still was in progress.

Also around that time, several Stanford players ran onto the field and argued with the officials that the play should have been whistled dead because Garner’s knee had hit the ground. Several penalty flags were thrown for “illegal participation” by the band members’ presence and for Stanford having too many men on the field.

As Ford raced toward the end zone, he began dodging band members, and as he was being tackled inside the Stanford 30, he pitched the ball back over his right shoulder, not knowing if a teammate was behind him. But Moen was there. He picked the ball out of the air at the 25 and ran into the end zone for a touchdown to make it 25-20. Shortly after crossing the goal line, he ran into a trombone player, Gary Tyrrell, and barreled him over.

Utter disbelief

advertisement | advertise on newsday

Elway and the entire Stanford sideline stood in shock as the officials huddled at midfield to discuss how they would rule the play. After a long discussion, a touchdown was signaled. Cal was declared the winner.

“It was a pretty traumatic thing for a 22-year-old kid,” Elway said about the outcome. “We thought we had the game.”

For several days, Elway walked around in a daze, unable to come to terms with what had happened.

“Obviously, we were frustrated, and I will tell you this,” he said. “I was very hopeful for the next 48 hours that [the NCAA] would reverse the outcome. I hoped I was going to see that in a headline.”

Actually, he did see it in a headline.

Several staffers from Stanford’s student newspaper decided to pull a prank by publishing a four-page edition of “The Daily Californian,” the student newspaper at Cal. The headline across the front page read, “NCAA awards Big Game to Stanford.”

Several students — including Elway — believed the story at first. Some Cal students who caught wind of the story were seen crying, because they thought it was true.

“I did believe it,” Elway said. “I wanted to believe it, but obviously that got tamped down in a hurry. I was always hopeful [the NCAA] would say, ‘Nah, we’re just kidding. We’re going to overturn it. Stanford wins.’ ”

To this day, whenever Stanford is in possession of the Axe for the year, the score of the 1982 game is changed on the plaque to read: Stanford 20, Cal 19.

Memories haven’t faded

Elway said he learned one very powerful lesson from that game.

“If anything, you just realize that no game is over until it’s over,” he said. “I don’t fall asleep on any onside kicks, so I make sure I pay attention to those, because I know that anything can happen.”

Rivera said the game will forever live on for him.

“I have fond memories of that, because first of all, it was Cal vs. Stanford, and any time we come out on top, we’re excited about that,” he said. “I know John’s not happy about it, but it’s one of those things that — to a lot of us Cal guys especially — it goes down in history as one of the all-time great games.”

Rivera feels no sense of remorse that the kickoff return might have been whistled dead after Garner’s knee appeared to hit the ground.

“We all have our own perception,” Rivera said. “To me, there have been some games that were settled on teams that have gotten fifth downs that shouldn’t have gotten them. To me, that would be so much less satisfying a victory than what happened in that game. That game came down to a judgment. Was [Garner] down or not? That’s a question that will be forever asked.”

The two men haven’t talked about the game in the handful of times they have crossed paths in the years since, but they have mutual respect for each other.

“[Rivera] was a great football player, and he’s done a hell of a job with the Panthers, walking in there and what he’s done there,” Elway said. “He’s a nice guy, too, a guy that has come a long way, worked his tail off, worked his way up the ranks. I’m happy for him.”

Rivera calls Elway one of the greatest quarterbacks ever and has “tremendous respect for his career and for the job he’s done with the Broncos” as their general manager.

More than 33 years after playing in one of the most memorable games in football history, the two men again will compete from opposing sides in what figures to be another unforgettable game.

Chances are the ending to Super Bowl 50 won’t be nearly as bizarre.