NEW YORK (AP) — The New York Knicks were scouting Kristaps Porzingis ahead of the 2015 draft when they noticed one of his teammates in Spain.

Willy Hernangomez eventually joined Porzingis in New York, and after his promising rookie season both were considered key pieces for the team's future.

Now Porzingis is headed for surgery and Hernangomez is on his way to Charlotte.

The Knicks traded Hernangomez to the Hornets on Wednesday in a deal that brings back second-round picks in the 2020 and 2021 drafts, plus forward Johnny O'Bryant.

Hernangomez was an all-rookie selection last season and had been identified by team management during the summer as a one of the young players to build around. But the Knicks then acquired Enes Kanter from Oklahoma City in the Carmelo Anthony trade and Hernangomez fell to third in the center rotation behind Kanter and Kyle O'Quinn.

"He showed last season that he can contribute when given the opportunity and we believe that the added depth he provides will benefit our frontcourt rotation," Hornets general manager Rich Cho said in a statement.

The deal came hours after the Knicks lost Porzingis to a torn ACL. There was thought after the injury that Hernangomez could finally get back into the rotation in his friend's place, but the Knicks instead decided to deal him.

They were teammates in Seville and after the Knicks took Porzingis with the No. 4 pick, they acquired Hernangomez's rights after Philadelphia drafted him at No. 35.

Hernangomez averaged 8.2 points and 7.0 rebounds last season and was voted to the All-Rookie first team. But the Spanish national team player couldn't get on the floor this season, appearing in just 26 games and averaging 4.3 points and 2.6 rebounds.

O'Bryant averaged 4.7 points and 2.6 rebounds in 40 appearances with the Hornets.

___

More AP NBA: https://apnews.com/tag/NBAbasketball