New Orleans Pelicans center Julius Randle (30) during the second...

New Orleans Pelicans center Julius Randle (30) during the second half of an NBA basketball game in New Orleans, Thursday, March 28, 2019. The Pelicans won 121-118. (AP Photo/Tyler Kaufman) Credit: AP/Tyler Kaufman

The best-laid plans were plotted months ahead, pairing Kevin Durant and Kyrie Irving to fill the massive amount of salary-cap space cleared and save the day in New York. The Knicks just didn’t plan on the Brooklyn Nets being the recipients of the star power infusion.

As free agency officially kicked off Sunday night, the Knicks saw the stars they had coveted months ago — and still planned on pursuing with fingers crossed but fading faith — ticking off the board: Durant and Irving going to Brooklyn, Kemba Walker going to Boston and even Kristaps Porzingis signing on to a max deal worth $158 million over five years with Dallas.

The Knicks instead came to terms with Julius Randle, 24, signing the power forward to a three-year, $63 million deal. The third year is a team option.

Randle spent four years with the Lakers (breaking his right tibia in the opener in the first year and playing only one game) before signing with the Pelicans last season and having the best season of his career. He averaged 21.4 points and 8.7 rebounds, expanding beyond the below-the-rim interior game he’d shown to that point. He had a two-year, $18 million deal with the Pelicans but opted out of the second year at $9.1 million and struck paydirt with the Knicks.

The Knicks then came to terms on a two-year, $20 million deal with Taj Gibson, 34, a hard-nosed, defense-oriented frontcourt player. He’s hardly a star, but Gibson is a solid veteran on a team in need of one.

The Knicks completed their night by signing a third power forward, Bobby Portis, 24, who averaged 14.2 points and 8.1 rebounds in a season split between Chicago and Washington.

Knicks president Steve Mills said in a statement, “While we understand that some Knicks fans could be disappointed with tonight’s news, we continue to be upbeat and confident in our plans to rebuild the Knicks to compete for championships in the future, through the draft, targeted free agents and continuing to build around our core of young players.”

With their dreams of signing Durant extinguished, Mills and general manager Scott Perry flew to Los Angeles on Sunday to meet with Randle and Reggie Bullock, hardly the sort of players the team was selling when Porzingis, the franchise’s centerpiece, was traded to clear the cap space for the star chase. Mills and Perry have taken a more cautious approach than Madison Square Garden chairman James Dolan about free agency, but they certainly had something more in mind than this.

So the Knicks were left as they so often are, watching and wondering why the allure of the Garden and the marketing power of New York were not enough to convince any of the top-tier free agents to take their money or even take a meeting with them.

The bold statement from Dolan months ago will resonate in the ether throughout what now appears to be another rebuilding season. “New York is the mecca of basketball,” he said on ESPN radio earlier this year. “We hear from people all the time, from players, representatives. It’s about who wants to come. We can’t respond because of the NBA rules, but that doesn’t stop them from telling us, and they do. I can tell you from what we’ve heard, I think we’re going to have a very successful offseason when it comes to free agents.”

If those words aren’t the ones that resonate, it instead will be Dolan emailing a fan who implored him to sell the team four years ago: “In the meanwhile, start rooting for the Nets because the Knicks don’t want you.” What once sounded like a challenge now might be a decent plan.

The 17-65 Knicks had hoped to turn their fortunes in free agency, figuring that they would go to a max contract on a top-tier player — Kawhi Leonard, Durant or Irving. After Durant announced his deal with the Nets, a report surfaced on ESPN that Dolan and the Knicks were unwilling to go with a four-year, $164 million max contract for him because of uncertainty about how he would recover from his ruptured Achilles. That did not match up to the plan before free agency began.

The Knicks now have what they hope is a star in place in No. 3 overall pick RJ Barrett along with second-year players Kevin Knox, Mitchell Robinson and Allonzo Trier. Dennis Smith Jr. came over in the Porzingis trade and Frank Ntilikina, the lottery pick from 2017, remains on the roster and is only 20.

But the lesson the Knicks can learn from the Nets is that it wasn’t about lottery picks. The Nets drafted wisely and accomplished what the Knicks have preached — player development.

Now the Knicks will enter the second year of the David Fizdale era, the third year of the Perry era and an almost countless number of years of frustration. You have to go back 20 years to find their last NBA Finals appearance and rewind all the way to 1973 for the last time they won a title.

Perry and Mills have said the $70 million of cap space wasn’t just about this summer’s free-agent class. They said it was about maintaining financial flexibility, whether it meant carrying it over into another free-agent class (although the 2020 class looks as if it will pale in comparison to this year’s group) or for a trade. Until then, they wait, preaching patience once again.

Newsday LogoYour Island. Your Community. Your News.Digital AccessOnly 25¢for 5 months