One of the Lakers’ most weighty contracts and awkward locker room situations has come to an end.

On Saturday morning, the team bought out forward Luol Deng under the waive-and-stretch provision of the Collective Bargaining Agreement. The deal will allow the 33-year-old to enter free agency and end a Lakers tenure that never got off on the right foot, while giving the Lakers a chance at a max free agent next summer to be a potential running mate with LeBron James.

Waiving Deng will still cost the Lakers against the salary cap for the upcoming season, but they’ll be able to spread out the remaining salary owed for the last season of the deal (2019-20) over up to three years. It also opens the possibility that Deng could earn a new contract elsewhere, which could help offset the amount the Lakers owe him.

Terms of just how much of the approximate $36 million the Lakers will still have to pay were not immediately available, although ESPN reported that Deng left $7.5 million of his remaining salary on the table as part of the deal.

General Manager Rob Pelinka wasn’t coy about the reasoning behind the buyout in a statement released by the team: “We made this move to further our future salary cap and roster flexibility, as we continue to build this Lakers team according to our current overall vision.”

Since Pelinka took over in 2017 in sweeping changes to the Lakers’ front office, Deng has not been a part of that vision.

Deng was one of the Lakers’ dubious legacies from a spending whirlwind in the 2016 offseason, and the former Bulls, Cavaliers and Heat forward never produced as hoped in Los Angeles after signing a four-year, $72 million deal. He averaged just 7.5 points per game in 57 total contests, playing only once last season as the Lakers sought minutes for a young core under a new front-office regime.

The Lakers are expected to be big players next summer in a free agent market that could include Kawhi Leonard, Kevin Durant, Klay Thompson and Jimmy Butler, among many others. Media reports suggested that the Lakers may have opened up north of $36 million in cap space to use in 2019, which is enough to add a second max contract player next to James, who signed earlier this summer.

Aside from clearing future salary cap space, which the Lakers need for a wide-open free agency market in the summer of 2019, erasing Deng from the roster also clears some extra space from the team’s large group of wings and forwards.