For months, well-placed sources have been predicting that Tyler Seguin’s days with the Bruins were numbered, not just because of his soft, underachieving performance on the ice but largely because of his immature lifestyle choices.

Those sources clearly were onto something, because the Bruins yesterday made the decision to part ways with the No. 2 overall pick in the 2010 draft, who they feel is headed for trouble with his nightlife pursuits. The B’s shipped Seguin to the Dallas Stars in a blockbuster seven-player deal that returned talented and gritty winger Loui Eriksson.

Eriksson is a player fans will like because he fits the Bruins mold perfectly. Many people around the team never really warmed up to Seguin, the player or the person.

Eriksson has scored as many as 36 goals in a season and is a speedy, hard-working, responsible two-way forward. The B’s, who also included Rich Peverley in the deal, get several million in needed cap relief and more flexibility in the free agent market, which opens today at noon.

“There was an opportunity to get a very good player, get some good prospects and to lower your cap,” Bruins general manager Peter Chiarelli said. “And then maybe to improve in the next market (free agency) starting (today).”

Peverley had a disappointing season, with six goals, 12 assists and a minus-9 rating in 48 games. He had only two assists in 21 postseason games. The final player from the B’s side was 22-year-old defenseman Ryan Button.

“There are no strictly on-ice decisions on any decision you make with a hockey player,” he said. “So no, it’s not a strictly on-ice decision.”

This trade might not be popular among all Bruins fans, who envisioned Seguin as a future superstar. But he might go down as a player who squandered his great gifts. Multiple sources said the 21-year-old Seguin crossed the line this season with reckless partying.

It apparently got so bad that during the playoffs, the Bruins ordered Seguin to live in a hotel, where a guard was hired to make sure he stayed in his room.

But Chiarelli repeatedly defended Seguin, calling him “a good kid and a terrific player” and “a tremendous package of speed and skill.”

Chiarelli spoke at length about Seguin’s reputed off-ice misbehavior. It was generally assumed that when the GM recently expressed concerns about the Seguin’s “professionalism” and “focus,” that’s what he was talking about. But he insisted those comments were about the forward’s preparation for games, not his partying.

“I don’t want to really play that up too much,” Chiarelli said. “He’s a 21-year-old that played as an 18-year-old, and I think he was just a 21-year-old kid. He was maturing and growing up, and he liked to have fun like the rest of them. I don’t really think it was such a big deal. But when I said earlier about focus, just about little things, about preparing to play — it was nothing about extracurricular activities.

“No player is perfect, either as a player or an individual. All his stuff mushrooms into a proliferation of items on social media and I get overwhelmed by the number of stuff that comes out. Maybe some of it is true, but I know not all of it is true. . . . Tyler is a 21-year-old, he is a good kid, he’s got a good heart and he is going to continue to grow up.”

Dallas GM Jim Nill focused on Seguin’s considerable upside.

“Tyler is a dynamic player that will be part of our core group for a long time to come,” Nill said. “A player at his age, position and talent level are extremely difficult to acquire, and we’re thrilled to bring him into our organization.”

Seguin will be used at center by the Stars, although he did not look comfortable with the two-way demands of the position in limited action this season.

Eriksson, who turns 28 on July 17, is a former All-Star. Last season, the 6-foot-2, 200-pound Swede had 12 goals and 17 assists in 48 games. In 501 career games, he has 150 goals and 207 assists.

The Bruins also received 20-year-old defenseman Joe Morrow (the 23rd overall pick in 2011) and forwards Reilly Smith and Matt Fraser. It seems reasonable that all three could be in the running for NHL jobs next season.

The departure of Seguin will not affect the future of Nathan Horton, who is weighing several offers and will jump to a different team when free agency begins today.

The Bruins have not yet finalized a new contract for goalie Tuukka Rask, which Chiarelli hoped to have done by the start of free agency. But an announcement on a rich, long-term deal is expected soon.

Meanwhile, the Bruins now have a little money to toss around on free agents. They have a player who was born to wear the spoked “B,” and even if they don’t want to talk about it, they got rid of a problem child who still needs to do some growing up.