Ilya Kovalchuk is staying with the New Jersey Devils, agreeing to a staggering 17-year, $102 million deal with the team.

Kovalchuk’s agent and the team announced yesterday that the high-scoring left winger agreed to stay with New Jersey, ending weeks of speculation where the league’s leading goal scorer since 2001 would be skating next season.

The deal is somewhat salary-cap friendly for the Devils, who will absorb an annual hit of $6 million, the average amount per season. However, Kovalchuk will remain on the books through the 2026-27 season.

The Devils, Los Angeles Kings, New York Islanders and SKA St. Petersburg of Russia’s Kontinental Hockey League talked with Kovalchuk after free agency started on July 1.

The final decision came down to the Kings and the three-time Stanley Cup champion Devils. Grossman refused to say that Kovalchuk decided to stay because he felt the Devils had a better chance to win the Cup again.

“Obviously his goal is to win the Stanley Cup,” Grossman said. “If he didn’t think there was an opportunity to do that, then he would not have gone there.”

Devils president and general manager Lou Lamoriello did not immediately return calls.

The 27-year-old was traded to the Devils by Atlanta in February after rejecting a 12-year, $101 million extension offered by the Thrashers.

Kovalchuk had 41 goals and 44 assists last season when he earned $7.5 million. He posted only 10 goals and 17 assists with the Devils.

Flyers deal Gagne

New Tampa Bay Lightning general manager Steve Yzerman added a big offensive chip to his club by trading for Philadelphia Flyers forward Simon Gagne. Tampa Bay sent defenseman Matt Walker and a fourth-round pick in next year’s draft to get Gagne, who spent 10 seasons with the Flyers.

In 664 NHL games, Gagne has 259 goals and 265 assists. He ranks ninth on the Flyers’ career list in goals and 10th in points and games played. He had 17 goals and 23 assists in 58 games last season and added nine goals and three assists in 19 playoff games as Philadelphia reached the Stanley Cup finals before losing to the Chicago Blackhawks in six games.

Gagne, 30, led the Flyers in goals three times, including two 40-goal seasons. He is eligible to become a free agent after next season.

Minor trade

The New York Rangers acquired defenseman Matt McCue from the Anaheim Ducks for forward Tomas Zaborsky.

McCue has yet to play in an NHL game. Zaborsky played last season with Assat Pori (Finnish Elite League).