DETROIT — Matthew Stafford has made a home in the Motor City, leading the Detroit Lions on the field and becoming a first-time father with twin girls earlier this year.

“Aggressive start,” Stafford recently cracked.

The Lions, likewise, made an aggressive move to keep their franchise quarterback around for many more years with the richest contract in NFL history.

Stafford agreed to a $135 million extension, according to a person familiar with the deal. The person spoke to The Associated Press on condition of anonymity because financial terms of the contract were not disclosed. The team announced the five-year deal keeps Stafford under contract through the 2022 season.

He was entering the last year of his $53 million, three-year deal.

Stafford stood to get quite a raise and did, getting more than the $125 million, five-year contract the Oakland Raiders gave Derek Carr this summer.

Stafford recently said he hadn’t decided whether he would allow negotiations to drag into the season if both sides failed to reach an agreement before Week 1.

“I had no expectations going into it,” Stafford said last week. “So, I’m doing myself and our team a disservice if that’s what I’m worried about. I truly am letting the guys upstairs here, and my agent, hash it all out. And, I’m just trying to be as good a football player as I can be and help our team.”

Detroit drafted Stafford No. 1 overall in 2009 and gave him $41.7 million in guarantees as part of a six-year contract worth $78 million coming out of Georgia. Shoulder and knee injuries stunted his first two seasons, but Stafford played in every game the next six years.

Stafford won the 2011 AP NFL Comeback Player of the Year award after throwing for more than 5,000 yards and helping the Lions end their 11-season playoff drought.

That year, he helped Detroit become the first team in league history to rally and win four games after being down by at least 13 points, including 20-plus point comebacks at Dallas and Minnesota.

Last season, the Stafford-led Lions became the first NFL team to come back from fourth-quarter deficits to win eight games in a season.

He helped the Lions reach the playoffs for the third time in six seasons, but wasn’t able to help them win in the postseason for the first time since the 1991 season.

It certainly hasn’t been his fault.

He hasn’t ever had a strong running game to lean on and he lost a superstar receiver last year. Despite the retirement of Calvin Johnson last season, Stafford was having one of his best years until a finger injury and stiffer competition stunted his and the team’s success.

Stafford throws spirals with a lot of zip and power, squeezing passes into tight windows. He also lofts passes deep down the field with one of the strongest arms in the league. And teammates like him, making him an easy-to-follow leader.

Looking to improve, though, he worked with a QB guru for the first time during the offseason. Stafford trained with Adam Dedeaux at 3DQB in California, where Tom Brady and Drew Brees have gone to refine their skills.

Both the team and Stafford expected to figure out a way to keep him in Detroit.

“That’s something we do have on the agenda. … It’s a priority, but it takes two sides to do a deal,” Lions general manager Bob Quinn said during the offseason. “I’m not making any promises one way or another, but I’ve always said since I’ve gotten here that Matthew is a good quarterback and I’d like to have him here long term.”

The feeling was mutual with Stafford saying he would “love to” sign a long-term deal.

“I’ve had a really good time playing here,” Stafford said.