ANAHEIM, California — Swedish forward Rickard Rakell agreed to a six-year, $22.8 million deal Friday to stay with the Anaheim Ducks.

Rakell has 29 goals and 49 assists in 165 games for the Ducks, who drafted him in the first round in 2011. He scored 20 goals for Anaheim last season while ranking fourth on the team with 43 points, emerging as one of the Ducks’ top young offensive threats.

The restricted free agent didn’t participate in training camp while technically holding out for a new deal, although he would have been unable to play anyway after surgery last month related to his appendectomy last spring.

The surgery kept Rakell out of the World Cup of Hockey, but the 23-year-old is working out again in Sweden with hopes of returning to hockey before the end of October. He will return to Anaheim when his visa is acquired, and he is expected to play on one of the Ducks’ top two lines.

“It’s something we both agreed was common ground for the two of us,” Ducks general manager Bob Murray said. “The injury held us up a little bit. We wanted to be totally comfortable Ricky was going to be OK going forward. He’s over 200 pounds right now and he’s skating.”

Rakell’s contract, which runs through the 2021-22 season, absorbs two potential seasons of unrestricted free agency.

With Rakell’s deal complete, Murray can turn his full attention to re-signing defenseman Hampus Lindholm, Rakell’s fellow restricted free agent. Lindholm is still at home in Sweden, depriving the Ducks of an elite young blueliner as they begin their first season under returning coach Randy Carlyle.

Murray had no progress to report on negotiations with Lindholm’s representatives, but he is speaking with them frequently.

“There’s lots of different things that could happen with Hampus,” Murray said. “We’re trying hard to get that accomplished. Both sides are talking. We have no idea what that deal is going to be.”

Copyright 2016 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.