Rafael Devers is staying in Boston.

The Red Sox and their star third baseman are finalizing an 11-year, $331 million contract extension, setting up the 26-year-old slugger as the cornerstone of the next generation at Fenway Park. Following some high-profile departures in recent years, Devers will be the clear face of the franchise — and its offensive catalyst — for years to come.

Here are a few of the biggest questions surrounding the blockbuster deal — and what it means for the Red Sox moving forward.

For many in Boston, one question immediately comes to mind: Why did Devers get a mega-extension when two other homegrown superstars — outfielder Mookie Betts and shortstop Xander Bogaerts — are no longer wearing Red Sox uniforms?

Shortly after getting the team’s chief baseball officer job ahead of the 2020 season, Chaim Bloom famously traded Betts when ownership mandated he get the Red Sox under the luxury tax threshold. The decision to trade Betts — in Bloom’s mind — represented the best way to rebuild the farm system and cut salary, with veteran left-hander David Price and his contract included in the deal with the Los Angeles Dodgers. Betts eventually signed a 12-year, $365 million deal with the Dodgers — a deal he told ESPN in August he would have signed in Boston — while the Red Sox received Alex Verdugo, Connor Wong and Jeter Downs, the latter of whom the team designated for assignment this offseason and was claimed by the Washington Nationals. The trade drew substantial backlash and remains a sore spot among fans.

Then this winter, Bogaerts, a four-time All-Star and two-time World Series champion, became a free agent after he and the team failed to come to an agreement on a contract extension ahead of the 2022 campaign. Bogaerts had said he was hopeful he could spend the rest of his career in Boston but instead received an offer of an additional year and $30 million on top of the three years and $60 million left on his previous contract. The offer felt like “a slap,” according to a source close to Bogaerts. Bogaerts subsequently signed an 11-year, $280 million deal with the San Diego Padres last month.

The truth is, Boston had always prioritized signing Devers over Bogaerts. The Red Sox front office views Devers as potentially a generational bat. Since his MLB debut, Devers has posted a 162-game average of 103 runs, 179 hits, 44 doubles, 33 homers, 107 RBIs and 324 total bases, according to ESPN’s Paul Hembekides.

But the biggest factor for the front office was their ages. While Bogaerts hit free agency as a 30-year-old, Devers only recently turned 26. While Bloom and his front office did not feel comfortable giving a long-term contract to a player who’d be in his 40s by the end of the deal, Devers will be just 37 when this contract is up.

Why was this deal so important to get done now?

According to multiple sources during the December winter meetings, the Red Sox and Devers were more than $100 million apart. That also was when Bogaerts signed with the Padres. After that blow, Bloom told ESPN in December the team would go “beyond reason” to try to get an extension done with Devers and, ultimately, the team significantly increased its offer to bring the final total to 11 years and $331 million.

Not signing Devers to a contract extension would have created a season-long distraction for the Red Sox. Had Boston not signed Devers before spring training, the third baseman would not have wanted to negotiate until next offseason, according to sources close to Devers, increasing the chances the slugger would reach free agency. That lack of clarity would have only increased the speculation already brewing over whether the team needed to trade Devers rather than lose another star player in free agency — in other words, a repeat either of the Betts trade or what happened this past season with Bogaerts.

And locking up Devers not only makes him Boston’s centerpiece player for the foreseeable future, it also removes a lot of uncertainty surrounding the franchise. While retaining Devers was always a top priority, the departure of Bogaerts put pressure on the front office. Bloom admitted to ESPN that he had regrets over the Bogaerts negotiations. And sentiment had grown in the front office, according to multiple sources, that the team needed to make a move “for the fans” after that backlash. The Devers deal is fan-friendly and still aligns with Bloom’s vision for the team’s future.

How does the Devers deal fit Boston’s relatively frugal five-year plan?

Bloom’s hope is to build back the farm system and — despite the setback with Downs — there is progress on that front. First-base prospect Triston Casas will likely be the team’s starter on Opening Day. Shortstop Marcelo Mayer is creating a lot of excitement about the team’s future at the position as both an offensive force and a defensive whiz. Outfielder Ceddanne Rafaela had a breakout season in 2022 both offensively and defensively, hitting .299/.342/.538 with 21 homers, 28 stolen bases, 32 doubles and 10 triples in 116 games across Single-A and Double-A.

The next step, according to multiple front office sources? Signing some of these top young contributors to extensions before they reach arbitration. Bloom believes giving established stars long-term deals into their 40s is simply too risky an investment.

Instead, signing a player to an extension before he hits arbitration — similar to deals given to Alex Bregman by the Houston Astros, Tim Anderson by the Chicago White Sox and Mike Trout by the Los Angeles Angels — allows both the player and team to take on a similar amount of risk. The team gets the benefit of locking up a promising young player on a deal that could be below market value, while a player guarantees his family generational money before he turns into a superstar.

What’s the next move for the Red Sox this offseason?

Catcher is a spot the front office identified as a potential area for improvement heading into the offseason — and the team has yet to make a move there. The team has Reese McGuire, acquired at last season’s trade deadline, and Wong, who has played just 33 games in the big leagues.

The Red Sox previously showed interest in trading for Sean Murphy — who ended up with the Atlanta Braves — and signing former Boston backstop Christian Vazquez, who is now a Minnesota Twin. With the notable free agent catchers signed, Boston would need to explore a trade.

The Red Sox could also make another move to improve their starting rotation, though the recent signing of veteran righty Corey Kluber to a one-year deal alleviated some of that need.

What can fans expect from the team this season?

The Red Sox front office, at least, expects this group to compete for the playoffs, but it will need a lot of things to go right.

Boston sees big things ahead for Japanese outfielder Masataka Yoshida, who came over this winter from the NPB, and hopes free agent addition Justin Turner can replace the production of J.D. Martinez, who signed with the Dodgers. Boston will also need more production from Trevor Story, Boston’s prize free agent acquisition heading into the 2022 season. Enrique Hernandez will need to stay healthy, while Casas must perform better at first base than Bobby Dalbec, who was one of the lineup’s weakest links last year.

On the pitching front, a combination of a healthy Chris Sale and consistency from a mix of Nick Pivetta, Garrett Whitlock, Tanner Houck, Brayan Bello and Kluber in the rotation is a must. The bullpen should be improved with the additions of Kenley Jansen and Chris Martin.

Still, in a tough American League East, with an improved New York Yankees team that added an ace in Carlos Rodon, talented teams in the Toronto Blue Jays and Tampa Bay Rays, and a young Baltimore Orioles group that hopes to build upon it success in 2022, the Red Sox will need a lot of things to go their way — both in their clubhouse and around the division — for the team to avoid another last-place finish and make a legitimate push for October.