SANTA CLARA — Brock Purdy carved an improbable path to fame, and now he has the fortune to go with it.

The 49ers are rewarding Purdy with the largest contract in team history — one rich with quarterback legacies — all in hopes he’ll lead them out of a 30-year Super Bowl drought. It’s a five-year, $265 million deal that averages $53 million per year, matching Detroit’s Jared Goff for the seventh-highest mark among NFL quarterbacks, as first reported by NFL Network and confirmed by league sources.

The guaranteed loot is what truly reflects the 49ers’ multiyear commitment to Purdy: Of $181 million in guarantees, $165.05 million comes in the first three years.

The 49ers and Purdy’s agent, Kyle Strongin, declined to comment as the contract is still being finalized.

Starting literally from the bottom of the 2022 NFL Draft, Purdy, 25, vaulted into the Top 10 of contracts leaguewide, and now he reaps the rewards for that three-year ascent highlighted by four playoff wins, including the 2023 team’s NFC Championship en route to a Super Bowl overtime defeat.

The 49ers have emboldened Purdy as the face of a franchise that’s deep into a younger-and-cheaper roster transition to prepare for this extension.It’s one of the last pieces of the puzzle for the 49ers, who last month signed tight end George Kittle to a four-year contract extension worth $76 million and infused their roster with 11 draft picks and six undrafted free agents.

Purdy has spent the offseason laying low, working with teammates and showing up for Phase 1 of the 49ers’ offseason program before the contract was complete.

The 49ers’ hierarchy of owner Jed York, coach Kyle Shanahan and general manager John Lynch have praised Purdy all offseason.

York, in the thick of negotiations, dubbed Purdy a Top 10 quarterback in the NFL.

“Especially when you combine him with Kyle (Shanahan) and you combine him with what we have, he’s a heck of a quarterback and we want him to be here for a long, long time,” York said April 1 at the NFL’s annual meetings in Palm Beach, Florida.

Making quick work of contract negotiations was Purdy’s goal from the first day he became eligible for one, stating on Jan. 6: “I know that I’m the guy for this organization and I can do what it takes to help lead us where we want to go.”

Purdy earned less than $1 million in salary each of his previous three seasons, and he was entering the final year of his rookie contract (four years, $3.7 million).

The 49ers braced for Purdy’s pay raise, in part, by revamping their roster this offseason and losing 19 players to other teams, including nine starters.

“When you make that change, you have to make sacrifices somewhere,” York said of signing an “obviously underpaid” quarterback to a market-level extension.

Purdy’s selection with the 262nd and final pick of the 2022 draft covered for the 49ers’ daring move a year prior when they traded three first-round draft picks to the Miami Dolphins to gain the No. 3 overall pick and use it on Trey Lance. The 49ers paid Lance close to $25 million for four career starts, then traded him to the Dallas Cowboys prior to the 2023 season after he lost out to Sam Darnold as Purdy’s backup.

The 49ers haven’t had to pay top dollar for a quarterback since gambling on Jimmy Garoppolo in February 2018 when he received a five-year, $137.5 million contract that briefly stood as the largest in NFL history. In 2014, the 49ers signed Colin Kaepernick to a six-year, $114 million deal, but Kaepernick played only three more seasons before opting out of a restructured deal.

The quarterback legacies that loom larger are those of Joe Montana and Steve Young, who combined to deliver the 49ers’ five Lombardi Trophies.

“It’s tough, dude, being in the shoes that I am in now and the pressure from the guys having brought championships back to San Francisco,” Purdy said in March on the “Built 4 More” podcast. “Not comparing myself to their style of play, but, like, what they did for the city and everything, that’s more of the pressure I feel.”

Purdy’s financial and playing future was in doubt only two years ago when he tore the ulnar collateral ligament in his right elbow in an NFC Championship game loss in Philadelphia. Purdy rebounded so well that he set a 49ers single-season record with 4,280 passing yards in the 2023 season, which culminated with playoff comeback wins over the Green Bay Packers and Lions before the overtime loss to Kansas City in Super Bowl LVIII.

More health issues arose this past season. A sore throwing shoulder kept him out of a Nov. 24 loss at Green Bay, then his surgically repaired right elbow got jolted on a Dec. 30 sack by the Lions and he sat out the Jan. 5 finale at Arizona.

Entering the offseason, he did not want a contract stalemate like those in recent years by teammates Deebo Samuel (2022), Nick Bosa (2023), Brandon Aiyuk (2024) and Trent Williams (2024).

“I’m not the kind of guy that wants to have any kind of drama associated with anything,” Purdy said Jan. 6.

Purdy is 23-13 as a regular-season starter after winning his first 10. Since a 2023 Christmas night loss to Baltimore, he is 9-11, including that 2-1 playoff run.

Last season’s team crumbled all around Purdy as it lurched to a 6-11 record and last-place finish, losing seven of the final eight games. His 65.9 completion percentage was the worst in three seasons and he regressed to just 20 touchdowns with 12 interceptions as injuries hit the offense. He did show enhanced mobility, rushing for career highs with 66 carries, 323 yards, and a team-high five touchdowns.

“We have interest in Brock being around here for a long, long time,” Lynch said Jan. 8. “He’s done so much for our organization, he’s won big games. Had a little tougher task, as we all did, this year with some of the things that happened throughout the course of the year.”