SANTA CLARA, Calif. — Gary Kubiak wasn’t sure he’d ever get another chance at being a head coach again, not after how badly it ended in Houston in 2013, and not in a league in which head coaching stability grows more fleeting every season.

But through a unique set of circumstances, Kubiak was summoned by his former NFL roommate, Broncos general manager John Elway, to replace John Fox after his unexpected ouster last January. Today, he’s one win away from realizing Elway’s dream of building his first Super Bowl champion as an executive.

“I feel very fortunate that I’ve gotten another chance, because a lot of coaches don’t,” Kubiak said Tuesday as the Broncos continued preparations for Super Bowl 50 against the Panthers on Sunday.

Elway, who roomed with Kubiak for much of his Broncos’ career, feels vindicated by his decision to oust Fox and bring in his former backup quarterback. “This is why we made the decision,” Elway said. “This was the idea — to get better and get past the first round. The idea, the goal, is to win a championship. That’s why the decision was made last year to go in a different direction, and Gary’s done a tremendous job.”

It was a daunting challenge for Kubiak. He was replacing a coach who had been to the playoffs four straight seasons — three with Peyton Manning and once with Tim Tebow rescuing the 2011 season after a 1-4 start. Throw in the fact that Manning would have to adapt to Kubiak’s more run-centric offense, as well as the quarterback’s own declining skills, and Kubiak’s task seemed all the more difficult.

But give the coach credit. He found a way to win, even with Manning not at his best. And when the 39-year-old quarterback had to step away because of a partially torn plantar fascia, Kubiak shepherded first-time starter Brock Osweiler through a major transition period, all the while keeping Denver in control in the AFC West.

advertisement | advertise on newsday

When it came time to switch back to Manning during the regular-season finale against San Diego, with homefield advantage in the playoffs on the line, Kubiak’s move did the trick. Two playoff wins later, Kubiak can be the first Denver coach to earn a ring since Mike Shanahan led Elway’s Broncos to titles after the 1997 and 1998 seasons.

“I came to a team that was successful, so for me, it was about coming in and finding out what they were about, who the leaders were, those types of things, the mind-set of the team,” Kubiak said. “I remember the first day I called every player on this football team when I came here. I told them I was proud to be a part of them and I had a lot of respect for what they’d done in the past. Then we went to work.”

There was plenty of uncertainty, especially when Manning seemed so uncomfortable taking most of the snaps from under center after spending his career mostly in the shotgun. Kubiak eventually moved him back to his familiar position in the shotgun, but still, the play calls were much different than Manning was used to.

Giants videos

Where he had once been free to throw as many times as his heart desired, Kubiak preferred a more balanced approach that relied on the running game and strong defense. Manning’s first-half struggles underscored the difficulty. He had only nine touchdown passes and 17 interceptions, by far his worst career numbers, before being forced out of the lineup with the foot problem.

But the break did wonders for Manning, who hasn’t thrown an interception in the three games since he returned. He has only two touchdown passes, against the Patriots in the AFC Championship Game.

“I think a lot of it has to do health-wise now that he’s feeling better,” Kubiak said. “As we approached the time where we took the break because of his foot, I watched him play, and he wasn’t playing healthy. Getting back totally healthy, feeling real ly good physically and mentally, has helped him over the course of the past month.

“But I think he would tell you he also understands the team he’s on and the type of defense we’ve been playing, and that when we protect the football, it gives us a very good chance to have some success. I think he has bought into that and done a great job.”

Kudos to Kubiak as well.