Ever since the 49ers decided to head into the 2022 NFL season with Trey Lance as their starting quarterback, Jimmy Garoppolo's days in the Bay looked numbered. However, as the months went by, the team found it difficult to move him.

Having faced rehab from shoulder surgery when most teams were active on the market, by the time Garoppolo was cleared there were not many openings left. In the end, San Francisco seemed to have no option but to release him in order to avoid paying the $24.2 million he was due this season.

But the Niners found another solution. On Monday, the team and Garoppolo agreed to a restructured one-year deal worth $6.5m fully guaranteed that could rise to $16m through incentives. Of course, this agreement took many by surprise, including 49ers head coach Kyle Shanahan.

Kyle Shanahan happy that 49ers kept Jimmy Garoppolo

"It was pretty shocking for us," Shanahan said, via 95.7 The Game. "We thought it was a win-win for both sides. … It makes us a much better team. It seemed like everybody was waiting for us to cut him to see what they could get him for.

"Jimmy thought this was the best situation for him, this is obviously a better situation for the 49ers. We have a starting quarterback as a backup. The rest of the league had a chance to get him.

"We have zero worries about Jimmy not having a playbook. I don’t have one either. … He’s been rehabbing, he’s in great shape. He’s ready to go. ... When I told Trey that Jimmy’s coming back, he said, 'Awesome.' Trey and Jimmy have a great relationship. Trey is actually grateful to have Jimmy in the building."

The idea of keeping Jimmy Garoppolo as backup seemed unlikely a few months back. But things have changed, and this looked like the best solution for all. The Niners not only have an insurance policy for Lance, but they also avoided letting Garoppolo go for nothing - possibly to division rivals Seahawks. As for Garoppolo, being on the bench wasn't in his plans before but at this point, he didn't have many options elsewhere.