The Cleveland Cavaliers needed a backup center following Tristan Thompson’s free agency departure. Now they have one.

The Cavs acquired JaVale McGee and a 2026 second-round pick from the Los Angeles Lakers in exchange for Alfonzo McKinnie and Jordan Bell, league sources tell cleveland.com.

While the Cavs have a $3.9 million trade exception, McGee’s expiring contract ($4.2 million) does not fit, forcing them to include McKinnie and Bell — both of whom are on appealing non-guaranteed contracts and may get waived by Los Angeles. The Lakers are expected to use that freed-up cap space to sign center Marc Gasol to a two-year deal.

McGee, 32, has played with six teams during his 12-year NBA career.

This past season with the Lakers, his second year with the Western Conference power, McGee started 68 games, averaging 6.6 points, 5.7 rebounds and 1.4 blocks.

A 7-footer with vast playoff experience and three championship rings, McGee is expected to be Andre Drummond’s backup, giving the Cavs another much-needed rim protector after they finished last in defensive efficiency and blocks this past season. McGee’s expiring contract makes him a potential trade chip as well.

The Cavs entered free agency with the hopes of keeping Thompson — at the right price. But Thompson, who was part of the Cavaliers’ 2016 title team, agreed to a two-year, $19 million contract with the Boston Celtics on Saturday night. Sources say the Cavs, who explored a few different center options on Sunday, ultimately wanted a veteran with experience behind Drummond. McGee fits that profile. They were also uneasy about paying big money over multiple years to any of the remaining free agent centers.