The NFL’s quarterback shuffling has begun, and the first blockbuster trade of the offseason is in place. The Detroit Lions agreed to send Matthew Stafford to the Los Angeles Rams for fellow quarterback Jared Goff and a king’s ransom of draft picks that includes two first-round choices and a third-round selection.

The trade agreement was confirmed Saturday night by a person familiar with the deliberations. The deal cannot become official until March 17, when the NFL’s free agent market opens and trading can resume.

The Lions will receive first-round choices in 2022 and 2023 along with a third-rounder this year. The trade gives new homes to quarterbacks selected first in the draft — Stafford in 2009 by the Lions and Goff in 2016 by the Rams.

The Lions had agreed to consider trade offers for Stafford as part of deliberations, initiated by him, designed for the sides to part ways this offseason. With a new coach in Dan Campbell and a new general manager in Brad Holmes, the Lions are retooling, and now they have plenty of draft assets to assist their rebuilding efforts.

Holmes was the Rams’ director of college scouting when they drafted Goff. He dealt with his former boss, Rams General Manager Les Snead, on the trade. The Lions take on what many consider to be a cumbersome contract for Goff. He signed a four-year, $134 million extension with the Rams in 2019. The deal runs through the 2024 season.

Stafford, who turns 33 next month, is a former Pro Bowl selection who has two seasons and $43 million remaining on his contract. He is set to make $20 million in 2021 and $23 million in 2022. Stafford is due to be paid a $10 million roster bonus in March on the fifth day after the free agent market opens. That compelled the Lions to ensure there was a trade agreement in place by then.

Stafford could fit seamlessly into Coach Sean McVay’s offense, and his presence could help the Rams return to Super Bowl contender status after they were eliminated from the NFC playoffs this year with a divisional-round loss at the Green Bay Packers. The Rams will rely on a star-laden roster that now features Stafford to go with defensive tackle Aaron Donald and cornerback Jalen Ramsey. They haven’t had a first-round draft choice since selecting Goff in 2016, and now they aren’t scheduled to have another one until 2024.

Stafford has been productive and reliable. He started all 16 games in a season nine times in the past 10 years, even while playing through significant injuries. In 12 seasons, he has thrown for 45,109 yards and 282 touchdowns. He topped 5,000 yards in 2011 and surpassed 4,000 in seven other seasons. He threw for 4,084 yards and 26 touchdowns this past season.

Goff, 26, seemed on his way to stardom when he helped the Rams to the Super Bowl in the 2018 season. He was chosen to his second straight Pro Bowl that season and threw for 4,688 yards and 32 touchdowns. But he totaled 29 interceptions over the past two seasons, and McVay’s patience with him seemed to wear increasingly thin.

Stafford’s move to Southern California could be the first of several relocations this offseason by prominent quarterbacks. Deshaun Watson has asked the Houston Texans to trade him, although General Manager Nick Caserio said the team has no interest in accommodating that request. The Philadelphia Eagles must decide whether to move on from Carson Wentz, the No. 2 choice in the 2016 draft behind Goff; he was benched late in the season by former coach Doug Pederson.

Aaron Rodgers said following the Packers’ defeat to the Tampa Bay Buccaneers in the NFC championship game that his future in Green Bay is uncertain. Rodgers later said he has no reason to think he won’t be back with the Packers but knows little is certain in the NFL.