The Miami Heat completed a four-team trade that allows them to sign All-Star guard Jimmy Butler to a four-year, $142 million contract, league sources told ESPN on Monday.

The Heat are sending center Hassan Whiteside to the Portland Trail Blazers, guard Josh Richardson to the Philadelphia 76ers and a protected 2023 first-round pick to the Los Angeles Clippers to secure the salary-cap flexibility to complete the sign-and-trade deal with the 76ers, league sources tell ESPN.

The Blazers acquired Whiteside for forwards Meyers Leonard and Maurice Harkless, sources said. Harkless and his $11 million expiring contract are headed to the Clippers in the deal, which is the reason the Clippers were able to extract the protected 2023 first-round pick.

The Clippers still hold the max salary space to sign free agent Kawhi Leonard, who they're pursuing. For the Clippers, Harkless represents a starting-level forward who can play with Leonard and provide depth behind him.

The Clippers already hold Miami's 2021 first-round pick, which was acquired in the Tobias Harris trade with Philadelphia in February.

The Dallas Mavericks had interest in acquiring Heat guard Goran Dragic in a previous, three-team construction of the Butler sign-and-trade, but they "changed course," Dragic's agent, Bill Duffy, told ESPN.

"In analyzing it, his salary was too high based on other things they're trying to do," Duffy told ESPN.

Dallas has been pursuing perimeter help in free agency, with an emphasis on tough defenders accomplished as 3-point shooters.

ESPN's Ramona Shelburne contributed to this report.