The Mavericks' Jalen Brunson, left, goes up for a shot...

The Mavericks' Jalen Brunson, left, goes up for a shot against the 76ers' Joel Embiid during the first half of an NBA game on March 18 in Philadelphia. Credit: AP/Matt Slocum

It was an hour before free agency was set to begin when the Knicks' last bit of competition for Jalen Brunson faded away as a league source confirmed that the Dallas Mavericks' planned meeting with their standout guard was off.

That cleared the way for what had seemed a fait accompli for weeks, that Brunson would head to Madison Square Garden, with family and friend ties to the Knicks, but more importantly a solid fit for what has been a gaping hole in their lineup for decades. In Brunson, the Knicks add a point guard who not only can score — evidenced by his 41-point performance against Utah in the playoffs this season — but will serve as a floor leader for a team in need of one.

Brunson met with the Knicks Thursday night and, according to ESPN, agreed to a four-year, $104 million deal with a player option on the final season — one more indication that Brunson is still betting on himself. The contract is a huge jump for a player who entered the league as a second-round pick, and a deal that, depending on how it is structured, should make him the highest-paid player on the Knicks, at least until the team negotiates a likely contract extension with RJ Barrett.

Brunson, who will turn 26 before the start of training camp, has steadily improved and saw his role increase this season, even playing beside Luka Doncic. He played 79 games and started 61. He averaged nearly 32 minutes per game and then saw his play elevate in the postseason when Doncic was sidelined with a hamstring injury. Brunson averaged 27.8 points in the opening-round series victory over the Utah Jazz.

The Mavericks had a chance to retain him at a much lower price but hesitated on tendering him an extension offer earlier this season to keep roster flexibility. And when they tried to get him to agree to a deal after the trade deadline he opted to play out his contract and enter the market as an unrestricted free agent.

The Knicks certainly would have a chance to indicate their interest. His father, Rick Brunson, was just recently added to the Knicks coaching staff as an assistant to Tom Thibodeau, a role he served in Chicago and Minnesota. The elder Brunson was also the first client of Leon Rose when the current Knicks president began his career as an agent. Jalen Brunson’s agent now is Rose’s son, Sam Rose.

There was a complication in their interest though as the Knicks were over the salary cap. The front office removed that obstacle beginning last Thursday when they unloaded the contract of Kemba Walker and the $4.5 million cap hold the No. 11 pick would have taken up in a series of trades. They then dealt Nerlens Noel and Alec Burks, putting them approximately $30 million under the cap — a number that could increase if they opt to waive the non-guaranteed $5.2 million contract of Taj Gibson and renounce the cap hold on Ryan Archdiacono.

While the move solidifies the Knicks lineup — currently a potential starting lineup of Brunson, Barrett, Julius Randle, Evan Fournier and Mitchell Robinson, there are still moves to be made, first with the Knicks trying to get back  Robinson, who is an unrestricted free agent.

But the acquisition of Brunson doesn’t push the Knicks into the status of a contender and with pressure mounting on Leon Rose and his front office, the Knicks are expected to be active in pursuit of other stars. The main bait that Rose holds is an abundance of draft picks — 11 first-round picks over the next seven drafts. But the contracts of Randle and Fournier have been shopped in the wake of the disappointing season on the court with the Knicks falling from a playoff berth two seasons ago to a 37-45 record.

The Knicks passed on a chance to offer a package of those picks Wednesday when the San Antonio Spurs dealt Dejounte Murray to the Atlanta Hawks for Danilo Gallinari and three unprotected first-round picks. That deal united a pair of Klutch agency players in Trae Young and Murray and with no protections on the picks the Hawks surrendered a package that the Knicks would be hesitant to match.

Knicks add Hartenstein. The Knicks reportedly have agreed to a two-year, $16.7 million deal with Isaiah Hartenstein, who is expected to serve as a backup to Robinson. Hartenstein is not exactly a stretch five, but he did display skills on the perimeter last season with the Clippers as a passer and he  converted 14 of 30 attempts beyond the arc.