Prior to hiring Kyle Shanahan ahead of the 2017 season, the 49ers fired their head coach in back-to-back seasons. Jim Tomsula and Chip Kelly each lasted just one year. San Francisco went 2-14 in 2016 before Shanahan arrived, and the Niners' roster wasn't exactly full of superstars.
Shanahan had multiple suitors hoping to turn the then-Atlanta Falcons offensive coordinator into a first-time head coach, and he ultimately landed in Santa Clara. But it wasn't easy.
"It was an interesting time," Shanahan said on The Ringer's "Flying Coach" podcast. "I mean, San Francisco wasn't my first choice, on paper."
In a different world, Shanahan wouldn't have even interviewed with the 49ers. That really nearly happened.
"I almost canceled San Francisco," Shanahan said. "The reason being -- it had nothing to do with San Francisco -- it was just my whole goal in life was to be a head coach and stay a head coach. It wasn't just to become one and say I got there.
"So, that was always my goal, is to wait until I had a good enough year and got an opportunity with that. And so, I didn't want to be tempted on anything wrong. I mean, you get so excited for the chance to be a head coach that a lot of guys will accept anything, which I just had learned, and I had watched my dad go through it the hard way. That's not what my goal was.
"So when I looked at San Francisco, I was nervous because they didn't have that setup, and they had changed coaches three years in a row. Their offense was ranked 31st. Their defense was ranked 32nd. It wasn't the best situation."
Shanahan clearly didn't see Colin Kaepernick as his ideal franchise quarterback. He also has admitted in the past he had plans to try to add quarterback Kirk Cousins, who he coached in Washington.
Prior to interviewing with the 49ers, Shanahan had just interviewed with the Jacksonville Jaguars for an hour, and was set to interview with the Denver Broncos the next day. He had 30 minutes to spare before meeting with the 49ers, and wanted to rest for a few minutes.
But he nearly overslept.
"As they're banging on the door, I'm trying to fix my tie," Shanahan said. "And I just opened it, and I said, 'Alright, let's go.' And we do the interview, and it was so real. I wasn't trying so hard to get the job, and they weren't trying hard to sell me.
"We were just talking."
He then explained his concerns to 49ers CEO Jed York, and Shanahan quickly sensed the two were on the same page. The two connected on Shanahan's time as a 49ers ball boy when his father Mike was a coach, and Kyle said his father's whole philosophy all started from the 49ers.
Shanahan came away more than impressed, and had a new favorite team he hoped to coach. His wife, however, was even more surprised.
"My wife asked me which one I liked the most," Shanahan said. "I'm like, 'Actually, the Niners is the only one I really feel good about,' and it shocked her because she knew how I talked the morning before."
His wife brought up all the previous questions Shanahan had about the 49ers before his interview. His answer: "I believe in the people."
Shanahan is entering his fifth season as the 49ers' coach. He has a 29-35 record, but already has led the 49ers to an NFC West title and trip to the Super Bowl, as well as drafting star players like Nick Bosa, George Kittle and Fred Warner.
The 49ers have made it clear they couldn't be happier with Shanahan leading the way, but history could look a lot different right now.