David Lee wanted to help turn around Golden State when he came to the struggling franchise as a high-priced free agent in 2010.

Five years later, Lee is leaving with a championship — and the respect of his teammates and loyal fans.

The Warriors agreed to trade the former All-Star forward to Boston for Gerald Wallace on Tuesday, a person with knowledge of the deal said. The person spoke on condition of anonymity because the trade can't become official until the moratorium on NBA business ends Thursday.

Lee injured his left hamstring in the final preseason game and his role diminished with the emergence of Draymond Green, the runner-up for defensive player of the year. The NBA champion Warriors have been looking to trade Lee this summer to limit the team's luxury tax hit next season.

Green wrote on Twitter that he wished Lee "nothing but the best and I appreciate you showing me the way Champ!!! Much love."

It became a near-certainty the Warriors would move Lee after agreeing to a five-year contract worth about $82 million with Green last week.

Lee is due about $15.4 million in the final year of his contract. Wallace is owed about $10 million next season.

But because Wallace's contract was signed after the most recent collective bargaining agreement, the Warriors can use the stretch provision and it will only cost the team about $3.3 million over the next three seasons — a huge tax savings.

Lee was the highest-paid player on the Warriors last season at $15 million. He was someone the roster was built around after he was acquired in a sign-and-trade deal with the Knicks in July 2010, and Lee led the way his first few years with Golden State alongside newly minted MVP Stephen Curry.

All-Star guard Klay Thompson wrote on Instagram after reports of Lee's trade surfaced: "it's tough to see my big bro D Lee go, Boston gotta great player and true pro. A true vet who looked out for me and all the young guys. I'm not alone in saying this but DubNation is gonna miss u my man!"

The 32-year-old Lee is averaging 14.7 points, 9.5 rebounds and 2.3 assists per game in 10 seasons.

Whether there's a role for Wallace on the Warriors is uncertain. The 6-foot-7 forward, who was an All-Star in 2010 with Charlotte, played sparingly for the Celtics last season — his 14th in the NBA since Sacramento selected him 25th overall in the 2001 draft.

Wallace averaged 1.1 points and 8.9 minutes in 32 games — both were career lows, as were his totals for the season of 11 assists, 57 rebounds and 286 minutes.

Anderson joins Wizards

Free-agent shooting guard Alan Anderson agreed to a $4 million, one-year contract with the Wizards.

The 6-6 Anderson, who played at DeLaSalle High School, played the past two years with the Nets, averaging 7.4 points and 2.8 rebounds last season.

Etc.

• The NBA fined Mavericks owner Mark Cuban $25,000 for commenting about the team's agreements with DeAndre Jordan and Wes Matthews during the league's free agent moratorium. Teams are prohibited from talking about free agents until Thursday.

• The Mavericks came to terms with free agent forward Charlie Villanueva on a one-year contract for the veteran's minimum.

• The Magic reached an agreement with free-agent big man Jason Smith on a one-year deal for $4.5 million.

•The Bulls will bring back guard Aaron Brooks on a one-year deal.