From the time the Timberwolves acquired guard Malik Beasley in early February, President of Basketball Operations Gersson Rosas said Beasley, due to become a restricted free agent this offseason, was going to be in the team’s long-term plans.

Rosas stood by that notion even as Beasley encountered legal trouble involving charges of drug possession and threats of violence for an incident at his home in September.

On Friday, when Rosas had the chance to prove that with the start of free agency, he backed up those words. The Wolves and Beasley agreed to a four-year deal worth $60 million, a source confirmed Friday night. The fourth year of the deal is a team option.

The Wolves took care of some other business Friday, officially welcoming point guard Ricky Rubio back to the Twin Cities by completing their trade with Oklahoma City.

In the deal to reacquire Rubio, the Wolves sent the 17th pick in this year’s draft, Aleksej Pokuševski, a second-round pick in 2024 and James Johnson to the Thunder in exchange for Rubio and the No. 28 pick, Jaden McDaniels.

Helping complete a web of trades to land them the 23rd pick, the Wolves also officially acquired that player, Leandro Bolmaro, in exchange for the draft rights to Mathias Lessort (a 2017 pick) and Detroit’s 2023 second-rounder that the Wolves officially acquired late Thursday night.

The Wolves also held a virtual news conference with Rosas, coach Ryan Saunders, No. 1 pick guard Anthony Edwards and McDaniels shortly before free agency began to introduce some of their new acquisitions.

But their biggest move Friday was keeping Beasley in town — and at a significant price.

Beasley, who turns 24 Thursday, had trouble finding steady playing time with Denver, the team that drafted him at No. 19 overall in 2016, but upon coming to the Wolves he became a starter and flourished while playing 33.1 minutes per game before the coronavirus postponed the season in March.

He averaged 20.7 points and 5.1 rebounds in 14 games with the Wolves and shot 43% from three-point range, making him a fit for the Wolves’ three-pointer-heavy system of play.

The addition of Edwards also didn’t remove Beasley from the Wolves’ plans as the Wolves believe Edwards and Beasley can coexist on the floor at the same time, with Edwards playing small forward, or possibly power forward in the modern NBA, while Beasley slots in as the shooting guard.

But after the September incident at his home, a larger question over Beasley’s fit with the Wolves emerged. According to police and charges filed recently, Beasley was accused of aiming a rifle at a couple and their teenage daughter in an SUV outside his house, where a large stash of marijuana and other guns were seized by police.

Documents also said Beasley was caught on indoor video surveillance pointing a rifle “in the general direction” of his 1-year-old son in the garage that same day. As a result Hennepin County filed to have his son put under court-ordered protection. The son remains in parental custody as a judge weighs the petition’s allegations.

But multiple times throughout the process, Rosas has supported Beasley, saying he was like family to the organization.

“We’re letting the legal course take its part there, but when we talk about family, it’s easy to do when it’s easy,” Rosas said Monday. “It’s hard when it’s tough, but we want to be supportive, we want to understand what’s going on, and we want Malik to be not only the best player but the best person he can be, and we’re all working through this together.”

That echoed a similar statement Rosas made in September shortly after the arrest.

Beasley responded on Twitter to a report of his signing with multiple “100” emojis.

On Thursday, Yahoo reported the Wolves were making Beasley available in trades, but a team source shot that down and the Wolves agreed to sign Beasley Friday.

His payday, an average of $15 million per season, is a steep one considering Beasley has only started 33 NBA games in his career. But the Wolves see him as an important complement to knock down the open shots Karl-Anthony Towns and D’Angelo Russell may create with the attention defenses will pay them.

The Wolves won’t have much room to maneuver below the luxury tax, so barring another trade the Wolves figure to be less active during the rest of the NBA’s condensed offseason.

But Rosas has still pledged to re-sign another restricted free agent, Juancho Hernangomez. The Wolves also have their mid-level and biannual exceptions to use, if they so choose.

Beasley rejoins a Wolves roster full of guards and small forwards with Russell, Edwards, Josh Okogie, Jarrett Culver and Rubio, who will now be setting up shots for Beasley.