Boston Celtics president of basketball operations Danny Ainge said that the thinking behind the moves the team made prior to Thursday’s NBA trade deadline — and specifically acquiring Evan Fournier in a deal with the Orlando Magic — was to give a team lacking in confidence a reason to have some optimism.

“I talk to [coach Brad Stevens] mostly every day. I talk to the players. I’m around the team, in the locker rooms, and I can just sense a feeling of discouragement and frustration, like would happen with any team that feels like it is playing below what it can play,” Ainge said Friday morning. “So it’s not any one incident or any one personality, but there’s a difference when things are going really well, and when things aren’t.

“But when you’re not living up to your expectations, the opportunity for discouragement and frustration creeps in and I think that happens with every team. It’s happened with every team I’ve been associated with. And so there is optimism and we get our team together and we have team meetings and film sessions and we go on a little run but we’re not able to sustain it.

“I just hope that by adding another veteran player that’s a versatile shooter with size and versatility that’s just going to give us a jolt.”

The Celtics, who are in Milwaukee to play the Bucks Friday night, certainly are a team that was in need of a jolt. Boston is just 21-23 on the season, and sit in eighth place in the Eastern Conference standings — far below the standard that Boston has set the past few seasons, when it’s been a consistent top-4 finisher and has made the Eastern Conference finals in three of the past four years.

This year’s group, however, has never clicked in nearly the same way after losing Gordon Hayward in free agency — a move that came on the heels of Kyrie Irving, Al Horford and Marcus Morris all leaving for nothing the prior offseason. Hayward’s departure, however, left Boston with a $28 million trade exception — which the Celtics used to land Fournier from the Orlando Magic for Jeff Teague and a pair of second round picks.

Fournier, 28, is averaging a career-high 19.7 points per game this season, and will give the Celtics another long, versatile offensive player who should fit nicely in Stevens’ system. And while he is on an expiring contract, Ainge said he hopes Fournier is going to be with the Celtics for a long time.

When Ainge was asked if the Celtics are now able to compete with the teams at the top of the conference – -the likes of Milwaukee, the Brooklyn Nets and Philadelphia 76ers – he said he wasn’t sure. But he said that wasn’t the only reason to make a move like this.

“I also feel an obligation to more than just [that],” Ainge said. “We’re dealing with people here. And I feel like we’re trying to get better all the time – every trade deadline, every offseason. And I felt like there was an opportunity. And we felt like there was more than one opportunity, but some of them didn’t work out.

“But with Evan in particular, I thought that this opportunity was unique. And to add a player of his caliber, we’ve talked often about shooting with size, here’s a 6-7 kid that is a good shooter, can playmake, can handle the ball. Just another creator for us. And a very consistent player. And we’re excited to add him. I think it is a good use of our [trade exception].” Boston, which also ducked out of the luxury tax by sending starting center Daniel Theis to the Chicago Bulls in a separate deal, has underwhelmed at both ends this season, with Ainge singling out the team’s drop from fourth in defense last season to 24th this season as a particular source of disappointment. And with the Celtics hovering around the fringes of the East playoff picture, Ainge decided now was the time to shake the roster up, in the hopes of Boston returning to something closer to the level it is used to playing at.

“This is a team I put together. I am responsible for it. I think that you talked about patience, I think I am very, very patient. I’ve been at this a long time. I think there’s a time to overreact, but I didn’t feel pressure to do any of these things. I feel that this is a deal I would have done at any time over the last few years, probably, with this opportunity. But I guess the greatest pressure is just I want our players to feel hope, and I want our coach to feel hope, and I sense some discouragement internally with our guys. So that was one reason why we did something now as opposed to waiting down the road.”