They spent long hours on Thursday putting the finishing touches on a franchise-altering trade.

And, oh yes, the Celtics selected a player in the NBA Draft in addition to agreeing to a trade that will send future Hall of Famers Kevin Garnett and Paul Pierce to the Brooklyn Nets.

Seven-footer Kelly Olynyk of Gonzaga, a native of Canada, was acquired by the Celtics with the 13th pick after they moved up three spots thanks to a trade with the Dallas Mavericks.

The 22-year-old Olynyk becomes the first player to join the Celtics in their rebuilding phase now that coach Doc Rivers is with the Los Angeles Clippers and Garnett and Pierce will soon be moving to the Brooklyn Nets.

Sitting at No. 16, the Celtics decided to swap places with the Dallas Mavericks, who also obtained two second-round picks in 2014 from Boston, so that they could pick Olynyk.

President of basketball operations Danny Ainge, who could not comment on the deal with the Nets, said that Olynyk will be a complimentary piece for the Celtics in the future.

“We watched him play a lot this year,’’ said Ainge. “He’s a seven-footer that can shoot, pass, think, has a great feel for the game. I think he’s a great complimentary player, a decent rebounder.

“I think probably just his IQ and his size (are strengths). He’s not an explosive athlete, but he’s got a quick mind and that makes up for a lot. He moves pretty well and anticipates very well and makes up for not being an explosive athlete.’’

Olynyk was the West Coast Conference player of the year after averaging 17.8 points and 7.3 rebounds in his junior season with the Zags.

An Academic All-American, Olynyk is studying for his master’s in business administration. He was born in Toronto and lives in Kamloops, B.C.

Ainge projects Olynyk to be a power forward rather than a center in the NBA thanks to his shooting ability.

“I don’t really see him as a center at all,’’ said Ainge. “I think as his body matures, he may be able to play some center, especially with so many teams playing small in the NBA.

“I see him more as a four man just because of his skill. I think him and Jared (Sullinger) will really compliment each other real well. They can both shoot the ball, pass the ball, guard multiple positions, are very smart.

Page 2 of 2 - “We’re trying to find good players, the best player available in the draft, not based on need. Kelly is a kid who is a seven-footer who played quarterback in high school. We’re very excited about him.’’

The Celtics also made a deal with the Indiana Pacers for the No. 53 pick and drafted Colorado State seven-footer Colton Iverson, who averaged 14 points.