The San Francisco 49ers and quarterback Jimmy Garoppolo have agreed to a massive five-year, $137.5 million contract, the biggest deal in the NFL history on an average-per-year basis, NFL Network’s Mike Garafolo reports.

Garoppolo was in the final year of his rookie contract, and the Niners had made it a priority to lock him up to a long-term contract this offseason. His $27.5 million per season, on average, is $500,000 more than the league's previous highest-paid player, Lions quarterback Matthew Stafford.

Garoppolo was an instant hit for San Francisco after they acquired him in late October from the New England Patriots for a second-round pick. The Niners, who were just 1-10 before Garoppolo took over at quarterback, won all five games he started as the team finished the season 6-10. He racked up 1,542 yards and six touchdowns with five interceptions in those five games.

Garoppolo, 26, spent his first three years in the league with the Patriots after being picked in the second round in 2014. He got to start for the first time in his career last season when Tom Brady was suspended and looked impressive in leading the Patriots to victory in both games he started.

But despite the widely-held belief that he would be Brady’s successor in New England, he was suddenly traded by the Patriots to the 49ers. There was some speculation that Brady had influenced ownership to force the Garoppolo trade.

However Garoppolo got to San Francisco, the 49ers liked what they saw in just over five games enough to make him the highest-paid player in the NFL and their franchise quarterback for the foreseeable future.