The Knicks didn’t get Lakers-bound LeBron James, but they got Super Mario.

The Knicks have agreed to terms with Magic 6-foot-8 combo forward Mario Hezonja on a one-year deal for a portion of their $8.6 million mid-level exception, according to sources.

The source confirmed ESPN’s report the pact was for $6.5 million — a deal that preserves cherished 2019 cap space and gives them a small-ball power forward to potentially start the season in place of the injured Kristaps Porzingis.

The signing likely ends the one-year Garden run of Michael Beasley, who could still sign for the $3 million non-Bird exception.

It also gives the Knicks the player selected right after Porzingis in 2015 at No. 5 by former Magic executive and current Knicks general manager Scott Perry. The Knicks have three of the top seven players selected in that draft, lending credence to Perry’s recent remarks about being in “talent acquisition mode.’’ Perry also landed Emmanuel Mudiay, selected seventh in 2015, from Denver at the trade deadline in February.

The Post reported Sunday afternoon the Knicks had made the offer for a portion of the mid-level so they can strategically use the rest to sign project center Mitchell Robinson, their second-round pick.

The sharpshooting Hezonja was seeking a multi-year deal, but he settled despite interest from seven other teams, including runner-up Portland.

An NBA source close to Hezonja said, “The main reason is David Fizdale. He sold him. The goal is to be here long term and finish his career. He was a fan of the team growing up.”

Indeed, Hezonja seemed thrilled and in a tweet wrote: “Start spreading the news…I want to be a part of it, New York,New York! Very excited to be joining the Knicks and play for coach Fizdale! A dream come true!!”

Hezonja, a 23-year-old from Croatia, finished the season shooting a subpar 33.7 percent from 3-point range despite a second-half surge that put him back on the Knicks’ radar. He averaged a career-high 9.6 points and 3.4 rebounds.

Hezonja is a career 33.2 percent 3-point shooter and has struggled with quickness on defense — which is why some scouts think he might be better as a small-ball power forward guarding slower players.

One NBA scout called him “a tease.’’

“Hezonja is an enigma to me,’’ another scout said. “He looked promising as a rookie only to regress until the second part of this past season. He looked awful the first half. Poor instincts, didn’t shoot it well. The second part, a light came on for a bit. But he’ll wind up being suited as a small stretch 4 versus his natural position at 3. His youth makes him worth a flier, as he can shoot and still has development potential.”

Perry may feel he already has skin in the game. As an Orlando executive, Perry was part of the decision to select Hezonja, who was about to be labeled a draft-lottery bust before last year’s uptick. But Perry himself, according to a source late in the season, had his doubts about Hezonja’s staying power when it was first reported the Knicks could have some interest.

The new Magic brass had elected not to extend Hezonja a qualifying offer, making him an unrestricted free agent.

The Knicks also had been in the hunt for veteran power forward Anthony Tolliver as Perry, Tizdale and team president Steve Mills all have talked to him since free agency began Sunday at midnight, according to a source. Tolliver, too, is seeking multiple years and has a handful of suitors, including the Mavericks and Clippers.

According to a source, the Knicks have also been involved in trade talks, possibly taking steps to dump Courtney Lee’s salary.

They could attempt to plug in another stopgap power forward with their $3.4 million biannual exception. They have reportedly reached out to Trevor Booker and Amir Johnson. But they now have 16 players under contract — one over the maximum. This includes Joakim Noah, a stretch-provision buyout candidate on Sept. 1.

The Athletic first reported Saturday the Knicks reached out to Hezonja. It’s unclear if Hezonja will fit into the long-term plans when he becomes a 2019 free agent as the Knicks eye big fish such as Kevin Durant, Kyrie Irving and Klay Thompson.

Signing Hezonja makes it a no-brainer for the Knicks to dump Lee — or even use the stretch provision on Sept. 1 that would save another $8 million in 2019 cap space. That gets them closer to being able to consider a Porzingis contract extension by the fall. The Knicks don’t want the extension to ruin their chance of having space for a maximum-salary free agent next summer.