OAKLAND, Calif. - David Lee wanted to help turn around the Golden State Warriors 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 the Boston Celtics for Gerald Wallace on Tuesday, a person with knowledge of the deal said. The person spoke to The Associated Press 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 this is the "part of the business that sucks!" 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 about $15 million. He was someone the roster was built around after he was acquired in a sign-and-trade deal with the New York Knicks in July 2010, and Lee led the way his first few years with Golden State alongside newly minted MVP Stephen Curry.

While his defence — or lack of it — remained a source of debate, Lee was a double-double machine and co-captain with Curry until this past season. In 2013, Lee became the franchise's first All-Star since Latrell Sprewell in 1997.

But Lee lost his starting job when he got injured and Green excelled in his place. Lee received only sporadic playing time depending on matchups and had several games when he didn't play.

Lee played the fewest minutes of his career and averaged just 7.9 points per game — the lowest since his rookie year with the Knicks in 2005-06.

But Lee never complained and never became a distraction. Instead, he embraced his role and embodied the team-first spirit that propelled the Warriors to their first NBA title in 40 years.

Lee's biggest contribution on the court might've come in the fourth quarter of Game 3 of the NBA Finals in Cleveland. The Warriors' comeback fell short, but the team regained its rhythm behind Lee's pick-and-roll play and ball-movement, which had been sorely lacking in the series.

Lee continued to play as a reserve and the Warriors won the next three games. He also funded a trip for the entire team to Las Vegas following the championship parade, and every player and coach continues to praise Lee's unselfish nature.

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.

With four picks in this year's draft — two in each round — Boston was hoping to trade its way into a potential star. But general manager Danny Ainge was stuck with his original picks after failing to engineer a deal like the one that brought Kevin Garnett and Ray Allen to the Celtics in 2007, leading to their league-record 17th NBA championship.

Wallace will have to fight for minutes on a deep and talented Warriors team that includes forwards Green, Andre Iguodala, Harrison Barnes, Marreese Speights and Brandon Rush.

___

AP Sports Writer Jimmy Golen in Boston contributed to this story.