The Dallas Cowboys brought the curtain down on one of the NFL’s longest-running sagas Monday, signing star quarterback Dak Prescott to a four-year contract worth $160 million.

The figure is the second-highest contract in total value terms in NFL history. It’s bettered only by Patrick Mahomes, who signed a 10-year extension with the Kansas City Chiefs worth a total of $500 million last year.

While the Cowboys did not officially disclose the terms, both ESPN and NFL Network reported the deal was worth up to $164 million and included $126 million in guaranteed money and a signing bonus of $66 million, the highest in NFL history.

The 27-year-old is set to make an NFL-record $75 million in the first year of the contract and an average of $42 million per year over the first three seasons. ESPN added that the deal is structured over six years but voids to four to give Dallas some much-needed breathing room in salary cap terms.

Prescott will pocket an average of $40 million a year over the duration of his new contract, making him the second-highest paid quarterback in the league behind Mahomes.

The Kansas City Chiefs star earns an average of $45 million a year after signing a monster 10-year extension last year, while Deshaun Watson ranks third in that particular list with an average of $39 million a year.

Russell Wilson and Jared Goff are next with $35 million and $33.5 million respectively.

Prescott is second only to Mahomes in the NFL in terms of guaranteed money, with the contract the latter agreed with the Chiefs including $141.4 million guaranteed.

Significantly, however, while the figure represents 31.4 percent of Chiefs quarterback’s contract, 78.7 percent of the amount of the worth of Prescott’s contract is guaranteed.

The $66 million signing bonus, meanwhile, is the largest ever handed out by an NFL team, edging out the $65 million Wilson pocketed when he signed a $140 million extension with the Seattle Seahawks in 2019.

Aaron Rodgers and Matthew Stafford are third and fourth on the list with signing bonuses worth $57.5 million and $50 million respectively.

The Cowboys used the franchise tag on Prescott last year and could have done so again this year, had the two parties failed to reach an agreement over a long-term extension.

Tagging Prescott for a second time would have cost Dallas $37.7 million—with his full salary counting against the cap in 2021—this year. Instead, the quarterback will count for just $22.2 million against the cap this coming season.

ESPN reported the Cowboys will place the franchise-tag on Prescott on Tuesday as a “procedural matter,” before holding a press conference the following day when they are expected to disclose the full terms of the contract.

Prescott was on track to obliterate several NFL’s passing records before suffering a season-ending leg injury in Week 5 against the New York Giants, which derailed the Cowboys’ season.

Prescott threw for 1,856 yards with nine touchdowns and four interceptions in five games as the Cowboys scored at least 31 points in four of their first five games, before managing just one touchdown in the first three games they played without their star quarterback.

Dallas missed the playoffs for the third time in five years after finishing 6-10 and a swift turnaround in fortunes will be expected next season.

There will be pressure on Prescott to deliver following his contract extension, particularly as the Cowboys will return a stacked offense next season. Wide receivers CeeDee Lamb and Amari Cooper are signed up through to the 2023 and 2024 season respectively, while star running back Ezekiel Elliott and tight-end Blake Jarwin are on the books until 2026 and 2023 respectively.

Dak Prescott #4 of the Dallas Cowboys celebrates his touchdown reception against the New York Giants during the second quarter at AT&T Stadium on October 11, 2020 in Arlington, Texas. Prescott signed a four-year, $160m deal with the Cowboys on March 8. Tom Pennington/Getty Images