For all the deal- and decision-making of the past two weeks, the Rockets’ first official deal of the summer fittingly was about a once prized acquisition leaving town.

The Rockets trade of Jeremy Lin was completed on Sunday, giving them the cap room they had hoped to use for Chris Bosh.

To get the Lakers to take on the final season of Lin’s contract, and the roughly $15 million they will pay him, the Rockets will also send their first round pick next season, unless it falls into the lottery. If they don’t send the pick next season, it will be protected through 10 picks for two seasons. If they still have not sent the pick, it will be protected through five picks for two seasons.

The Rockets also sent a second-round pick acquired from the Los Angeles Clippers. They will receive the draft rights to center Sergei Lishchuk, though he is not in their plans.

The Rockets later completed talks on another cap-clearing move, sending Omer Asik to the New Orleans Pelicans. The primary elements of that deal had not changed. Asik will go to the Pelicans with the Rockets receiving New Orleans’ first-round pick when it falls after the third pick and before the 20th pick of the draft.

The trade, however, was tweaked into a three-deal deal with Washington as part of a sign-and-trade for Trevor Ariza. The Rockets will also receive guards Alonzo Gee and Scotty Hopson. In four NBA seasons largely with the Cavaliers, Gee averaged 8.2 points per game.

The Rockets will send Omri Casspi to New Orleans as part of the deal. Casspi got off to a good start last season, but then struggled down the stretch and was not in the Rockets rotation in the post-season. He averaged 6.9 points per game, making 42.2 percent of his shots while playing much of the season as a range-shooting power forward. The second year of his contract had been non-guaranteed and he did not appear to be in their plans.

The trade of Lin, though expected since the end of the season, represented the end of an eventful two seasons in which Lin went from a coveted free agent and surprising pick-up to a reserve deemed expendable in the Rockets pursuit of a star.

“On behalf of the entire organization and Rockets fans around the world, I want to thank Jeremy for his contributions to our organization,” Rockets Owner Leslie Alexander said. “It has been a joy to watch Jeremy over the past few seasons. We wish him all the best in the future.”

Lin did not return messages, but posted a pair of tweets about his time in Houston and move to Los Angeles.

“Thank you to @HoustonRockets fans, media, Rockets staff, coaches and teammates for the last 2 years!” Lin wrote.

“I’m SO blessed to join the @Lakers and can’t wait to get started!!”