DETROIT — The Boston Celtics continue to make moves this offseason, agreeing to trade the longest tenured member of their roster.

The Detroit Pistons traded forward Marcus Morris to Boston in exchange for guard Avery Bradley and a second-round draft pick in 2019. Bradley’s arrival gives the Pistons a replacement for Kentavious Caldwell-Pope, who was a restricted free agent. Detroit renounced the rights to Caldwell-Pope, making him an unrestricted free agent.

Bradley averaged 16.3 points per game last season, but Boston is adding All-Star forward Gordon Hayward and moving on from Bradley.

Morris averaged 14 points for Detroit.

Celtics president of basketball operations Danny Ainge released a statement thanking Bradley for his contributions.

“It’s no secret that Avery had been one of my favorite players,” Ainge said. “Avery did a lot of the dirty work and often didn’t get the recognition that he deserved, but our coaches, staff, his teammates, and our fans who watched him play every night appreciated what a special player and person he is.”

Bradley bridged the gap from the era of Paul Pierce, Kevin Garnett and Ray Allen that won the 2008 NBA title. Picked 19th overall in the 2010 draft, he developed into one of the league’s best defenders, making the all-defensive second team in 2013 and first team in 2016.

Detroit, which missed the playoffs this past season, can slot Bradley into the backcourt alongside point guard Reggie Jackson. Bradley, who turns 27 in November, has been a better shooter from 3-point range than Caldwell-Pope, finishing at 39 percent last season.

The Pistons lose Morris, who has been a steady veteran and a mainstay in the starting lineup over the past two seasons. Detroit has another solid wing player in Tobias Harris, and the Pistons drafted sharp-shooting Duke guard Luke Kennard in the first round.

Boston, meanwhile, will look different from the team that was the top seed in the East in 2017 before being routed in the conference finals by Cleveland. Landing Hayward was a big step, and the Celtics took Duke’s Jayson Tatum with the No. 3 pick in the draft after trading down from No. 1. With Jaylen Brown – last year’s No. 3 pick – also in the fold, the Celtics look primed to contend for years to come.

Isaiah Thomas averaged 28.9 points last season, and Al Horford, Jae Crowder and Marcus Smart were all in double figures. Boston has plenty of bargaining chips it can use in future moves – the Celtics have been stockpiling first-round picks – and it will be up to Ainge to come up with the right mix.

Bradley is entering the final season of a four-year contract, so it’s not clear if he can be a long-term solution for Detroit. The Pistons went 37-45 last season, a disappointing mark for a team that was in the postseason in 2016. Much of the attention this offseason has centered on Jackson and big man Andre Drummond, since Detroit could use more production from that tandem. Bradley now brings some extra scoring punch – he averaged more points than any Pistons player last season.

Caldwell-Pope averaged 13.8 points, and his athleticism made him an asset on defense, but he shot only 40 percent from the field.