The San Francisco 49ers have locked down their projected franchise quarterback.

According to Mike Garafolo of NFL Network, Jimmy Garoppolo was set to reach free agency this offseason but has instead agreed to a five-year, $137.5 million deal to stay with the 49ers. Garafolo noted it’s the “biggest deal in NFL history on a average-per-year basis.”

Matt Maiocco of NBC Sports Bay Area reported the deal includes a total of $74 million in guaranteed money.

Adam Schefter of ESPN later reported that while the deal isn’t officially done, it “seems like only a matter of time.”

Garoppolo spent the first three-and-a-half seasons of his career with the New England Patriots, making just two starts while primarily serving as the backup to Tom Brady. Despite the limited playing time, the 49ers pulled the trigger on a trade shortly before the deadline in exchange for a second-round pick.

After an outstanding showing once he became a regular on the field, general manager John Lynch made it clear this is the long-term answer at quarterback, via Ian Rapoport of NFL.com:

“When you find the right guy at that position, it’s really good for your franchise. We believe we’ve found the right guy. Now the challenge is getting Jimmy signed. We’re working hard towards that. We’ll see. I think he wants to be with us and we want him there. I think it makes too much sense not to happen. So it’s just a matter of getting it done.”

The two sides were able to come to an agreement to keep the 26-year-old in San Francisco for the foreseeable future.

Garoppolo has already proved he has what it takes to lead the team to success, turning around what was one of the worst teams in the NFL with a 5-0 record as a starter after the 49ers went 1-10 to start the year. His 1,250 passing yards in his first four starts for his new team are the most in NFL history, according to David Lombardi of The Athletic.

The quarterback finished with 1,560 passing yards and seven touchdowns in six games for a 96.2 quarterback rating.

While he remains relatively inexperienced for someone drafted in 2014, San Francisco has faith in his ability to lead the team back into contention after four years without a playoff appearance.

If the organization surrounds him with an improved offensive line and more weapons, Garoppolo has a chance to be one of the top quarterbacks in the game.