The Sacramento Kings have agreed to acquire Harrison Barnes from the Dallas Mavericks for Justin Jackson and Zach Randolph.

The Kings will no longer have max cap space this offseason assuming he exercises his $25 million player option for 19-20. Sacramento wants to keep Barnes long-term. Dallas, meanwhile, will be able to reenter the 2019 offseason with cap space after taking on the contracts of Tim Hardaway Jr. and Courtney Lee last week.

Barnes was sitting on the bench with the Mavericks when news of the trade broke.

Barnes signed a four-year, $94 million deal with the Mavericks in the 2016 offseason after the Golden State Warriors agreed to sign Kevin Durant.