Ubisoft has successfully gotten Vivendi out of its hair. The gaming publisher and the multimedia conglomerate have agreed to a deal in which Vivendi will fully divest itself of Ubisoft, ending once and for all a yearslong effort by Vivendi that was seemingly intended to take control of Ubisoft.

Vivendi currently holds a 27.27 percent stake in Ubisoft, amounting to nearly 30.5 million shares, making it by far the largest stakeholder in Ubisoft. It will sell off that entire portion of the company. Under the terms of the deal, Vivendi may not acquire any shares in Ubisoft for a period of five years following the closing of the transaction.

The agreement is a win-win. Vivendi’s bid to gain control of Ubisoft — which it repeatedly denied was actually an attempt at a hostile takeover, even though that’s exactly what it engineered at Gameloft — ends here. (Gameloft was founded by a Ubisoft co-founder, and the Guillemots left the mobile publisher “with regret” amid Vivendi’s takeover.) That means that Ubisoft gets to continue operating as an independent company.

Meanwhile, Vivendi spent €794 million over the past three years to gradually acquire its shares of Ubisoft, and it’s now selling that stake for €2 billion, Vivendi said in a news release. The company told Polygon that it had no further comment on the deal.

“The evolution in our shareholding is great news for Ubisoft”

“The evolution in our shareholding is great news for Ubisoft,” said Yves Guillemot, CEO and co-founder of Ubisoft. “It was made possible thanks to the outstanding execution of our strategy and the decisive support of Ubisoft talents, players and shareholders. I would like to warmly thank them all.” Ubisoft said today that it is confirming the financial targets for its 2017-18 and 2018-19 fiscal years.

Vivendi’s stake is being split across a number of different parties. Ubisoft itself is buying back as much as 8.1 percent of its shares from Vivendi from 2019 through 2021. Guillemot Brothers SE — which represents Ubisoft’s founding Guillemot family — is buying 2.7 percent of the company in a cash transaction with Vivendi. That purchase will increase Guillemot Brothers SE’s stake to 15.6 percent overall.

Under the terms of the agreement, Ubisoft is welcoming two groups into the fold as “long-term investors”: the Ontario Teachers’ Pension Plan — an independent organization that administers pensions for about 318,000 teachers in Canada’s most populous province — and Tencent, the Chinese conglomerate that is already a major player in the gaming space.

Ontario Teachers’ is acquiring 3.4 percent of Ubisoft’s shares, while Tencent is buying 5 percent of the company. Neither investor is getting a seat on Ubisoft’s board of directors. The agreement prohibits Tencent from transferring its shares or increasing its voting rights or ownership stake in Ubisoft, a clause meant to prevent another Vivendi situation from arising.

The Ubisoft-Vivendi deal also entails a “strategic agreement” between Ubisoft and Tencent under which Tencent will “operate, publish and promote several of Ubisoft’s most successful titles on PC and mobile in the Chinese market,” Ubisoft said in a separate announcement.

Tencent is the largest gaming publisher in the world by revenue

“We are honored to start this new chapter of our relationship with Ubisoft, and to be able to bring many of Ubisoft’s creative and renowned titles to our Chinese customers,” said Martin Lau, president of Tencent, in the news release.

Ubisoft and Tencent did not name specific games that they’re planning to launch in China together. Asked for further information, a Ubisoft spokesperson told Polygon that the company has “nothing to share beyond what’s in the release.”

Tencent is currently valued at more than $550 billion. The Chinese internet giant runs QQ, a massively popular web portal and messaging service, and the billion-user social network WeChat. It is also the largest gaming publisher in the world by revenue. Tencent Games owns League of Legends developer Riot Games, and has significant stakes in companies such as Finnish mobile publisher Supercell (84.3 percent) and Unreal Engine developer Epic Games (40 percent). In addition, Tencent Games partnered with PlayerUnknown’s Battlegrounds maker PUBG Corp. to publish the game in China; it also worked with PUBG Corp. to develop the mobile version of PUBG, and is publishing it worldwide.

The remaining 8 percent of Vivendi’s shares will be sold to qualified investors through an accelerated bookbuild, under which the shares will be offered only through March 21. Ubisoft said that if there’s significant interest, the size of this offering could rise by up to 1.5 million shares, which would accordingly reduce the shares that Ubisoft has to buy back.

Update: Asked about specific games that Ubisoft wants to bring to China with Tencent’s help, a Ubisoft spokesperson told Polygon the company has no further comment. We’ve edited the article to reflect this.