LAS VEGAS — At February’s trade deadline, the Knicks were made aware the Nuggets were shopping shooting guard Arron Afflalo, and his first preference was being dealt to New York.

The Knicks staged talks with the Nuggets but didn’t have the assets to get a deal done for Afflalo, who had a player option for 2015.

When Afflalo was dealt to the Trail Blazers on Feb. 19 for a lottery-protected first-round pick and Thomas Robinson, he was disappointed.

Afflalo, who had two stints with the Nuggets and one with Orlando, opted out of his contract in late June and got a second chance at landing in New York on July 1.

“We told Denver the Knicks were where he wanted to be,’’ his L.A.-based agent Sam Goldfeder told The Post at the Las Vegas summer league Sunday. “Portland was never mentioned.’’

After one meeting with the Knicks on July 2, Afflalo said at Friday’s news conference he canceled the other two he had arranged, accepting the Knicks’ two-year, $16 million package.

For two years, Afflalo, raised in Compton, Calif., and schooled at UCLA, has had a hankering to play in New York.

“This is the happiest I’ve seen him as a professional,’’ Goldfeder said. “It’s like he was drafted again. This is where he wanted to be and feels the stars aligned for him. It’s the first time he got to choose, and that was meaningful to him. The electricity he found in the Garden was like no other place, and he wanted that environment. He’s looking to have the best season of his career.’’

Afflalo recalls a game two seasons ago between Orlando and the Knicks, both teams out of the playoff race. It came down to the wire and the packed Garden sounded like Game 7 of a playoff series. That struck him.

Even if his old Denver buddy Carmelo Anthony had yet to call him to offer congratulations, the 29-year-old shooting guard could barely contain his enthusiasm when he met a small group of Knicks writers Friday in a glitzy Las Vegas hotel ballroom on the strip.

“A franchise like the Knicks, people can say what they want, they’re not going to be down for long.’’ Afflalo said. “The city’s too great. The fan base is too great. The opportunities are too great that over time, you’ll have a great culture, great players trickling in slowly but surely. This is a city that deserves to be at its best.”

Team president Phil Jackson and GM Steve Mills wanted players eager to play in New York, not just live the big-city life. Afflalo emerged in that department and will be either the Knicks’ starting shooting guard or heavily used sixth man.

“They made me a priority on what they felt I could do offensively and defensively,’’ Afflalo said. “Lock in and defend my position at the 2-guard. I felt like it was a good fit. I want to be as impactful as possible on both ends.’’

Despite Saturday’s impressive summer-league debut, it’s unrealistic to ask 7-foot-3 rookie Kristaps Porzingis to become the secondary scoring option. Afflalo probably has to be that guy. Last season, he shot just 42.3 percent — his lowest in seven years.

“I’m capable of it,’’ Afflalo said. “I’ve proven that over the years. I’m capable of scoring 20 a night. Learning the triangle, I just want to figure out everything about it, be able to embrace it and enjoy it and pick my spots within it.”

Afflalo, an Anthony teammate for two seasons, used to be much closer with him. They would train in the offseason at UCLA when they were teammates. Afflalo, who now spends the offseason training in Vegas, hopes to reignite the chemistry on and off the court.

“We’ll have to see,’’ Afflalo said. “I think it’s going to be good though. He’s competitive, man, wants to win . I’m right there in line. We used to spend a lot of time in offseason, hanging out in L.A. with his family.’’

Afflalo’s role grew immensely in Denver after Anthony asked out during the 2010-11 season. Afflalo was dealt from Denver to Orlando in 2012.

The Knicks are his fifth team, after he averaged 11.4 points and shot 38.5 percent on 3-pointers in eight seasons with the Pistons, Nuggets, Magic and Blazers.

“Obviously I was a young player then, in my third year,’’ Afflalo said. “[Anthony] was playing with other veterans — Chauncey [Billups], Kenyon [Martin], Nene [Hilario]. I was like the little fifth wheel running around. It was good for my game and got better with him. He drew a lot of attention away from me and it got me a lot of open shots. I’m looking forward to that again. I don’t want to create false high expectations, but I’m really looking forward to start this year.’’