Shayne Gostisbehere, the Flyers defenseman whose slick skating and scoring as a rookie made him one of the NHL’s most exciting players, was dealt Thursday to the Arizona Coyotes in a truly bizarre trade.

The Flyers had to give the Coyotes second- and seventh-round draft picks in 2022 to take the puck-moving player they call “Ghost.”

The Flyers desperately needed salary-cap space in a flat-cap world, and Gostisbehere has a $4.5 million annual cap hit for the next two seasons. In “real” money, he is owed $3.25 million for each of those seasons.

“This was a difficult decision, but one we thought was necessary given the reality of the salary cap,” general manager Chuck Fletcher said. “Shayne has been a quality player for this organization since the moment he arrived in Philadelphia and has been a part of many special moments in his seven seasons as a Flyer.”

» READ MORE: New Flyers defenseman Ryan Ellis excited to ‘get settled and start a chase for the Cup’

Contacted on his cellphone, Gostisbehere did not want to comment. Fletcher said Gostisbehere, who had hoped to remain with the Flyers, was “professional” and “didn’t have a lot to say” when told he had been dealt. “We thanked each other. I don’t know that it was unexpected,” Fletcher said, adding that Gostsibehere will have a “bigger opportunity” in Arizona.

Assuming Cam York, Wade Allison, and Morgan Frost make the team, the Flyers now have $70.3 million of their $81.5 million (maximum) committed to 19 players. That leaves them with $11.2 million — up from $6.7 million — in cap space, and they still must sign restricted free agents Carter Hart, Travis Sanheim, and a backup goalie.

“I think we have the ability to fill all our holes and maybe focus on one or two of them,” said Fletcher, whose team could use a right-handed defensemen to play alongside Sanheim on the second pairing. “Ideally, if you can make a hockey trade where you’re moving dollars and taking dollars on, that could maximize your cap space.”

It is believed Fletcher is trying to deal one of his two high-priced wingers, Jake Voracek or James van Riemsdyk.

The expected raises Hart and Sanheim will receive, Fletcher said, played a part in dumping Gostisbehere’s full salary.

“We made the move we had to make,” Fletcher said. “I spoke to every team in the league several times going back a year and a half, and we had a pretty good idea of what the market was.”

Fletcher admitted he was surprised no teams offered anything for Gostisbehere. Instead, he had teams asking him to trade the Flyers’ top pick (13th overall) in Friday’s draft to take the defenseman off Philadelphia’s hands. Another team said it would take Gostisbehere if the Flyers included York, the Flyers’ No. 1 prospect.

“It’s a tough environment out there right now,” Fletcher said of an $81.5 million flat cap that may be around for a couple of years. “It’s tough to move money. I think everyone saw that with the Seattle expansion draft [Wednesday].”

He said he tried to trade Gostisbehere to Seattle, but the new team’s proposed deal was worse than Arizona’s.

Fletcher called Gostisbehere a “model citizen” and noted he was working out on his own Thursday at the Flyers’ practice rink in Voorhees.

Gostisbehere, 28, burst into the NHL and finished second in the rookie-of-the-year voting in 2015-16. He has had an up-and-down career since that season and has had his share of defensive shortcomings, but he bounced back from knee surgery and had nine goals in 41 games this year. He showed signs of being his old self.

Yet, there were no takers when he was placed on waivers during last season. Most thought he would draw some interest at some point this summer, when teams have more cap flexibility than during a season.

Didn’t happen, and Fletcher pulled the trigger.

“This was the best move we could make, and hopefully it allows us to get into some other opportunities” in the trade or free-agent markets, Fletcher said.

» READ MORE: The Flyers select 13th in Friday’s NHL draft. Here are some possible picks.

The progress shown by York, a mobile defenseman with similar skills and someone who can also run a power play, made Gostisbehere expendable.

Gostisbehere has played parts of seven seasons in the NHL, all with the Flyers. He posted 219 points (60 goals, 159 assists) in 381 regular-season games, and also appeared in 17 playoff games, recording five points.

Last season, Gostisbehere ranked second in scoring among the team’s defensemen with 20 points (9 goals, 11 assists) and led the Flyers’ defense in goals and power-play goals (5).

Gostisbehere led Flyers defensemen in scoring in his first four full seasons, and he was a two-time winner of the Barry Ashbee Trophy as the team’s best defenseman (2016, 2018), as voted by the members of the Philadelphia Hockey Writers Association and members of the Flyers broadcasting crew.

His 219 points are fifth all-time by a defenseman in Flyers history, while his 60 goals are fourth.

Gostisbehere was selected by the Flyers in the third round (78th overall) of the 2012 draft, and in 2014 he helped tiny Union College stunningly win its first national title. In the NCAA championship game at the Wells Fargo Center, he was plus-7 as Union whipped Minnesota, 7-4.

» READ MORE: From the archives of Mike Sielski in 2016: Ghost incomparable among Flyers defensemen