Fernando Tatis Jr., the emerging face of baseball, agreed to a 14-year, $340 million contract extension with the San Diego Padres on Wednesday, securing one of the largest guarantees in American sports history and wedding himself to the team with which he quickly established himself as a star, sources familiar with the deal told ESPN.

Tatis, 22, will receive the third-biggest deal in baseball history — and do so at a far younger age than Mike Trout and Mookie Betts, both of whom signed their megadeals at 27.

The mutual admiration between the team and Tatis was clear enough that the Padres hoped it wouldn’t be a mistake. And with a deal that will lock him up for nearly a decade and a half, through his age-35 season, the Padres convinced Tatis that small-market San Diego is where he belongs.

Tatis wasn’t willing to relinquish control of that. He will receive a full no-trade clause, allowing him veto power over any potential deal. The $340 million marks the largest deal given to a player before he reaches arbitration — nearly $200 million more than Trout’s first contract extension. Trout’s second extension set a domestic sports record of $426.5 million guaranteed, and Betts’ $392 million deal is now followed by Tatis’ contract.

Tatis joins Manny Machado, who plays third base next to him, as Padres with $300 million-plus deals — and they join New York Yankees duo Gerrit Cole and Giancarlo Stanton as teammates with such gaudy contracts. Both Machado and Tatis are represented by agent Dan Lozano.