TORONTO — In the end, the Knicks were intrigued by a lottery-pick point guard the franchise passed on in 2015 and a lottery-pick point guard GM Scott Perry once selected in Orlando.

The Knicks were in the ballgame for both Emmanuel Mudiay and Elfrid Payton, the athletic penetrator with the high-rise hair. The Knicks wound up with Mudiay before Thursday’s trade deadline. Why not Payton?

The Knicks could never come to an agreement with Orlando that made sense. The Suns traded a 2018 second-round pick to land Payton, who immediately becomes the Suns’ starting point guard, and the deal has been hailed as a steal.

The Knicks gave whichever is the less favorable of their two 2018 second-round picks in the three-team package and Doug McDermott, whom sources say the Mavericks plan to re-sign this summer.

Mudiay and Payton are similar in their athletic offensive attributes — well-sized penetrators who struggle with their outside shooting. However, the Knicks get a younger player in Mudiay, who is 21, and a better defender, according to NBA metrics. Drafted by Perry, Payton is 23 and has been in the league one season longer.

Plus, Payton is a restricted free agent this summer while Mudiay still has one year left on his rookie deal. Payton would go into free agency without having played a possession with the fallen Kristaps Porzingis.

“Mudiay versus Payton is a push to me,” one NBA executive said. “Not a fan of either, but it is worth the gamble to see what you have in Mudiay while he’s still on his rookie contract. And McDermott wasn’t in the long-term plans.”

However, if the Knicks could have added Joakim Noah to the Orlando package and gotten back Bismack Biyombo, they would have done the Payton deal. In a smaller package, the Knicks deemed Mudiay a better fit than Payton, with a chance to look at him next season before the 2019 offseason, when they will have significant cap space. In any case, the Knicks never had a deal on the table Orlando would have accepted.

“He’ll have a better chance to expand his game in New York,” one NBA official who has spoken to Knicks brass said.

That the Knicks parted with McDermott is not a big issue because he was going to be a restricted free agent and fell out of their future plans. His game tailed off quite a bit since December, particularly on the road, and he wasn’t the athletic defender team brass is looking for. The Mavericks prize shooters and feel they can get the best out of McDermott, obtained from the Thunder in the Carmelo Anthony trade.