When the 49ers started 0-9 to begin Kyle Shanahan’s tenure – the worst start in franchise history – there were a few silver linings the team could hang its hat on.

First – They were still competitive, in most cases. From Week 2 to Week 6, the 49ers became the only team in NFL history to lose five straight games by three points or fewer. They were a play or two away in each game from getting that elusive win.

Second – They were developing a young roster. Rookies like quarterback C.J. Beathard, tight end George Kittle, receiver Trent Taylor, running back Matt Breida, cornerback Ahkello Witherspoon, defensive lineman Solomon Thomas and linebacker Reuben Foster were all getting valuable reps. Some of those players might not have gotten that seasoning if aging veterans were kept around during the first year of a roster-wide rebuild.

Third – The 49ers were strengthening their bond. They became hardened by losing. They didn’t fracture like they might have in recent seasons. That much is a testament to Shanahan because those are the unknown factors facing first-time coaches.

Shanahan is one of the most respected game planners and play callers in the NFL. But could he galvanize an entire team? The 49ers could only guess before hiring him in February.

During the team’s recent four-game winning streak, its first since 2013, the answer seems to be a resounding, “yes.”

“I believe, it was hard when we went through it (starting 0-9), but the fact that we were able to get through it and still find a way to get some wins here recently, I think it made our team stronger,” Shanahan said Tuesday in a conference call.

“When you go through some really hard things with each other and you make it through there, I feel you get stronger from that stuff. I think our team has gotten tighter through it, they’ve gotten stronger, and that’s led to us starting to win a few games and having more confidence.”

Much of that confidence is coming from Shanahan’s new quarterback, who has dramatically altered the state of the franchise in just a few weeks.

Jimmy Garoppolo has the 49ers feeling like a team that could hang with any in the NFL after taking down AFC playoff contenders in consecutive games, including the 44-point performance Sunday against the Jaguars, who had the league’s top-ranked defense coming in.

Suffice to say, Garoppolo might not be enjoying his level of success if he joined a locker room that was broken by losing earlier in the season. The 49ers found a way to turn their bad start into something promising heading into another crucial offseason.

“I believe our team feels that they are tough enough mentally to get through anything,” Shanahan said.