WASHINGTON — The Capitals have signed center Lars Eller to a $17.5 million, five-year contract extension.

Eller will count $3.5 million against the salary cap through the 2022-23 season. General manager Brian MacLellan announced the deal Saturday.

The 28-year-old Dane was in the final year of his contract with the Capitals and would have become a free agent on July 1.

“This club and this city has been a great fit for me personally, for my family,” Eller said. “There’s just so many things that have been good about it. It’s been good for my career. I’ve found my game here, especially this year.”

Eller has 11 goals and 17 assists for 28 points in 53 games this season, three points shy of his career high. In 576 NHL games with the St. Louis Blues, Montreal Canadiens and Capitals, Eller has 96 goals and 113 assists.

The signing solidifies Washington at center. Eller has played on the third line the past two seasons behind centers Nicklas Backstrom and Evgeny Kuznetsov. Backstrom is signed through the 2019-20 season and Kuznetsov through 2024-25.

“Everybody in the league is dying for centermen,” Capitals coach Barry Trotz said. “And we have a lot of them. Those guys are assets in the organization. Every good team, it doesn’t matter what sport, if you’re strong up the middle, you’ve got a chance.”

Washington traded two second-round picks to Montreal for Eller at the 2017 draft. Eller grew frustrated during his six seasons with the Canadiens.

The No. 13 overall pick in the 2007 draft by the Blues, Eller was traded to Montreal in 2010 and never settled on a role as he moved between center and wing and played up and down the top three lines.

“I don’t like to go back to talk about it, but it was a different situation in Montreal,” Eller said. “I have more stability here. I get to learn from some of the best players in the league looking at (Kuznetsov) and (Backstrom) every day.”

Eller was one of three significant Capitals unrestricted free agents, along with center Jay Beagle and defenseman John Carlson.

“Lars had a good year last year,” MacLellan said. “This year, he’s taken his game probably up a notch.”