ANAHEIM, Calif. — 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 the Swede 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.

“I think 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.”

Murray said he wouldn’t necessarily need to trade another player to create room on his limited payroll for Lindholm. Defenseman Cam Fowler has been widely mentioned in trade rumors.

Murray is less optimistic about the health of defenseman Simon Despres, who left their season opener at Dallas on Thursday night with an unspecified upper-body injury.

Despres missed large stretches of last season following a concussion, and Murray clearly is concerned about a possible reoccurrence of symptoms. Despres didn’t absorb any major hits before leaving in the second period.

“He was not feeling good last night,” Murray said. “We’re trying to figure out what’s going on with him. He had those problems last year. Something is wrong here, and we’ve got to get to the bottom of it.”

After losing their season opener, the Ducks play at Pittsburgh on Saturday, continuing their five-game East Coast road trip before their home opener against Vancouver on Oct. 23.

Anaheim also assigned forward Joseph Cramarossa to its AHL affiliate in San Diego on Friday, a day after the Ducks claimed veteran forward Emerson Etem on waivers from Vancouver.

Etem joined the Ducks on their road trip Friday, but his equipment didn’t arrive with him from Canada in time for practice.