Ron Artest, who nearly derailed the Los Angeles Lakers’ championship drive, will apparently be joining them for the next joyride through the playoffs.

The Lakers agreed to give Artest their full midlevel exception, about $33 million over five years, with an opt-out after the fourth year. However, the parties left the door open to adjust the terms before the deal is signed Wednesday, including the possibility of a shorter contract, according to a person familiar with the talks.

The N.B.A. has a moratorium on signings and trades, and no deal can be completed until Wednesday.

“I am very excited to finally be going to L.A.,” Artest said in a statement released by his agent David Bauman. “For years now, the Lakers have expressed interest in having me play for them, but we could never get the stars to align. I’m finally a Laker and I can’t wait to get on the court with Kobe, Pau and the rest of the team, and play for Phil. I’m very, very excited to be a Laker. I look forward to helping the Lakers defend their championship, and it will be great to finally not get booed in the Staples Center.”

Artest, a fearsome defender and a potent scorer, is coming off perhaps his best season. He helped lead the Houston Rockets to a 53-29 record, despite the loss of Tracy McGrady to an injury. The Rockets pushed the Lakers to seven games in the Western Conference semifinals, after losing center Yao Ming.