Hong Kong (CNN Business) SoftBank is bailing out WeWork in a deal that will give the Japanese tech company almost total ownership of the troubled office space startup. It will also give disgraced founder Adam Neumann a chance to walk away with a massive $1.7 billion payout.

will pump $5 billion into The We Company and accelerate a $1.5 billion equity investment originally due to the company next year, according to a statement released by the two firms.

SoftBank, which is already WeWork's largest investor, is also offering to buy up to $3 billion worth of stock from existing investors and shareholders. SoftBank's Vision Fund will also exchange all of its interests in regional WeWork joint ventures across Asia, excluding the Japan joint venture, for shares in WeWork.

All told, the deal will give SoftBank 80% ownership of the beleaguered startup, an enormous boost over the nearly 30% that SoftBank and its Vision Fund are reported to already own

The rescue package is expected to value WeWork at about $8 billion, according to a person familiar with the matter. That's a stunning fall from a peak of $47 billion , and an additional embarrassment for a company that not long ago was planning to go public . At the lower valuation,would have put more money into WeWork to date than the company is worth.

SoftBank's stock dropped 2.5% in Tokyo after the deal was announced.

Adam Neumann, WeWork's controversial co-founder, will also step down from the company's board and become a board observer. He already left his role as CEO . Marcelo Claure, SoftBank's chief operating officer, will become executive chairman of an expanded WeWork board. The board will receive voting control over Neumann's shares.

The announcement did not disclose details of Neumann's payout, but the WeWork founder could walk away with up to nearly $1.7 billion. SoftBank's offer to buy Neumann's shares is capped at $975 million, and the package includes an additional $500 million loan to repay a credit line, plus a $185 million 'consulting fee' for SoftBank, the person familiar with the matter said.

Details of Neumann's payout were first reported by The Wall Street Journal

The deal caps a turbulent two months for WeWork, during which Neumann oversaw a disastrous attempt to take the firm public. The highly anticipated IPO was shelved after investors balked at its valuation and criticized the shared workspace provider's corporate governance.

But in a statement, SoftBank CEO Masayoshi Son downplayed the debacle.

"It is not unusual for the world's leading technology disruptors to experience growth challenges as the one WeWork just faced," Son said.

Sprint S Claure — who already holds multiple roles as CEO of SoftBank's international arm, SoftBank's chief operating officer, executive chairman of, and runs point on SoftBank's Latin American Innovation Fund — has now been tasked with turning around a struggling unicorn under intense scrutiny.

"The new capital SoftBank is providing will restore momentum to the company and I am committed to delivering profitability and positive free cash flow," Claure said in a statement.