When Kyle Shanahan took over as the 49ers’ head coach, it seemed pretty obvious that he would try to get QB Kirk Cousins down the road. So how did San Francisco end up handing Jimmy Garoppolo a massive contract? Shanahan walks us through the timeline.

If I told you a year ago that the 49ers would sign a quarterback to a five-year, $137.5 million deal during the 2018 offseason, you wouldn’t need to wire-tap Kyle Shanahan’s office in order to make an educated guess on who that player would be.

Kirk Cousins. Easy, right?

But here’s what you may not know—even after San Francisco dealt a second-round pick to the Patriots for Jimmy Garoppolo on Oct. 30, Shanahan and GM John Lynch had yet to shut the door on the idea of pursuing Cousins. Garoppolo had much to prove over the two months to follow, and the man Shanahan developed in D.C. in 2012 and ’13 lurked as an option if Tom Brady’s backup fell on his face.

“Yeah, of course, it was there,” Shanahan said over the phone early Friday afternoon. “Everyone knows how I feel about Kirk. And for anybody who knows how I feel about Kirk, I think this shows how I feel about Jimmy, the fact that we ended up doing this. I’m not a guy who’s going to get excited and just go with the momentum, at all. I usually do the opposite, question it to make sure I’m absolutely confident, and not go with the momentum or the excitement.

“Talking about Kirk, understanding where he could be in the next year, for me to feel this way about Jimmy? It says a lot about Jimmy.”

Garoppolo’s 5–0 run as the 49ers’ starting quarterback transformed the team. As he, Lynch and Shanahan stood on a stage and the team formally announced the contract on Friday in Santa Clara, it felt like a reception to the football wedding into which the Niners and new quarterback just entered. The new five-year deal sets a new mark for average per year ($27.5 million), and is second in NFL history in two-year ($61.2 million) and three-year ($86.4 million) cashflow.

And in the process, it did what previously seemed highly unlikely—slamming the door shut on the Cousins/Shanahan reunion that some considered a fait accompli from the minute San Francisco named their new coach a year ago.

How did it happen? Shanahan was nice enough to take us through it.

Jimmy Garoppolo, After Seven Career Starts, Is the NFL’s Highest Paid Player. It Was Only Logical

FEBRUARY 2017

Soon after Shanahan arrived from Atlanta, just after Super Bowl LI, the 49ers held the standard personnel meetings that teams with new regimes have, during which coaches show scouts what kind of player they’re looking for in each position. Every scout and coach who was in that room remembers the quarterback tape—and that there was a lot of Garoppolo on it.

“Jimmy was all over it just because of the way he throws,” Shanahan said. “Trying to show what we look for in throwers, and in how they throw the ball, Jimmy’s one of the best examples that I’ve ever seen.”

It wasn’t something that Shanahan had just noticed. Back in 2014, when he was Cleveland’s offensive coordinator and the Browns were vetting quarterbacks, Shanahan studied all the throws that Garoppolo had made at Eastern Illinois (he knew all of the quarterbacks in that draft class back and forth). More recently, he’d pored over tape of Garoppolo’s two starts in New England.

“The balance he has, that he can make any throw with just the torque of his upper body, when it’s like that, that means you don’t have to block perfectly, he doesn’t need much room to throw,” Shanahan said. “He doesn’t really have to hitch into a big throw. He can sit in there flat-footed like a Juggs machine and just shoot it out at any time. And he’s got as quick a release as you could imagine.

“He can sit in the pocket and let a play develop and not have to move around a ton, because he can just torque his upper body and do it. [Tony] Romo is a very similar guy, when you paint that picture. Tom Brady is very similar, he’s just slower twitch. Aaron Rodgers is like that. Anybody who torque with their upper body and make these throws, they don’t need the same pocket everyone else does.”

MARCH 2017

When the NFL combine rolled around, the Niners had a grand total of zero quarterbacks on their roster, and so it didn’t need to be said that the most important position on the field was a big need for Lynch and Shanahan when they arrived in Indianapolis. First up would be a crack at the veteran market.

“At that time, the only guys we thought were franchise quarterbacks that were being mentioned were Kirk and Jimmy,” Shanahan said. “And I knew Kirk wasn’t going to be a possibility. And I remember asking Bill [Belichick] personally down at the combine about Jimmy, and very quickly he told me that wasn’t a possibility. So we moved on from that. He told me he wasn’t going to trade him.”

To solve their quarterback problem, Lynch signed Brian Hoyer—Shanahan coached him in Cleveland—as a stopgap at the start of free agency, and drafted C.J. Beathard in the third round of the NFL draft in April. At this point the San Francisco brass was, in essence, conceding that it’s long-term answer at quarterback may not be on the roster for the 2017 season.

“I didn’t know if we’d be able to do it our first year here,” Shanahan said. “I did feel strongly that we’d able to get it done, at least, by time we were going into our second year.”

OCTOBER 2017

I asked Shanahan if there was a holy s--t moment when the call came in from the Patriots on Oct. 30, inquiring if the Niners would be interested in trading for Garoppolo.

“There really was,” he answered. “We were 0–8. We’d just gotten our asses kicked by Philly. I came in on a Monday and that was the last thing I was thinking about. And that ended up popping up. It’s different, because it’s a big deal, we want those draft picks. We know have a ways to go, we want to build this organization the right way. And what worried me was having to decide long-term on a guy in just a few games.”

Shanahan went to Lynch, and Lynch assured Shanahan that the franchise tag would give the Niners flexibility to push the decision for a year. It took a grand total of 10 minutes for the two to decide to accept New England’s proposal, and send their second-round pick to Foxboro for Garoppolo. The plan, at the time, was to give Garoppolo time, with the tag in the Niners’ back pocket.

“He was playing in a system where it’s a completely different language,” Shanahan said. “There was absolutely zero carryover. It’s almost counterproductive from a verbiage standpoint, because it sounds so backwards. He’d get a word he’d heard before that meant something totally different. In the heat of battle, when you’re cramming stuff in, that confuses you when you’re in pocket.”

NOVEMBER/DECEMBER 2017

You know the rest—Garoppolo went 5–0, throwing for 1,560 yards and seven touchdowns against five picks, completing 67.4% of his passes. Along the way, there were two things that really made Shanahan smitten. First, it was how Garoppolo improved by the week in his knowledge of the offense. And second, it was how he operated when his knowledge of the offense failed him.

“I was worried putting him in, because I knew it was impossible for him to fully be comfortable,” Shanahan said. “But it got to the point where we needed to, and to watch him out there where I knew he wasn’t totally knowing exactly what to do, and see him still succeed and still make some great plays? By no means was it perfect, but I know the situation he was in, everyone could see his talent.

“I knew he was making some plays that just came very natural to him. … He showed that he had a natural feel that you can’t really coach. He was born with it.”

And by the end, he was doing what the great ones do—elevating those around him.

“Our team got a lot healthier, and as he started to play better, our guys started to play better. And everyone rose to the occasion, and we finished strong,” Shanahan said. “Jimmy was a big part of that. The guys around him played totally different at that time than they did earlier in the year, which definitely helped jimmy. And it was enough, surprisingly, I didn’t think it would be, but what we had in those five games, I felt very confident about making a commitment to keep him here long-term.”

FEBRUARY 2018

So now the Niners go into the offseason with around $75 million in cap space—with Garoppolo’s new deal factored in—plus four picks in the first draft’s first three rounds, even after having sent their slotted second-round pick to New England. But maybe the biggest advantage they have is that there’s no need to worry about the quarterback spot anymore.

They have a 26-year-old answer to the question, and a 24-year-old backup, in Beathard, with extensive experience having started. And while Garoppolo cost a lot to keep, it sure beats the alternative.

“Everyone wants to talk the numbers. Man, that’s what quarterbacks cost. I don’t even think about the numbers,” Shanahan said. “I look at everything as, ‘Is this a top guy? Is this a guy that has a chance to be one of the better guys in the league?’ And once you believe that, you do whatever it takes to keep him. And that’s what it takes to keep him.”

As the Niners figured, Cousins will be available in a few weeks. But after all this, all Shanahan can do for his old protégé now is wish him luck.

That spot everyone had old No. 8 filling a year ago? It’s taken.