WeWork has secured a $9.5 billion rescue package from SoftBank Group Corp., a deal that hands 80% of the company to the Japanese conglomerate while capping one of the more dramatic business debacles in recent memory.

The transaction announced in Tokyo Wednesday marks the end of an era for the troubled co-working giant, which raised money at a $47 billion valuation in January, pulled out of a botched initial public offering attempt last month and is now valued at less than $8 billion in the bailout.

WeWork’s arc -- from one of the world’s most valuable startups to surrendering much of the company in an emergency bailout -- has captivated Wall Street and Silicon Valley. Founder Adam Neumann will now leave the company’s board as part of the package, to be replaced by SoftBank executive and newly appointed Executive Chairman Marcelo Claure. Neumann is set to walk away from the deal with as much as $1 billion from the sale of WeWork stock, a $500 million credit line from SoftBank and a roughly $185 million consulting fee, people familiar with the matter have said.

The deal with SoftBank, which includes $5 billion in new financing and an acceleration of a $1.5 billion existing commitment, grants a reprieve to WeWork parent We Co., which was on track to run out of money as soon as next month. The company has been racing to slash costs since it pulled its IPO in September, and is expected to fire thousands of employees this month.

“This is exactly the reason why people are suspicious about actual valuations of unicorn companies,” said Mitsushige Akino, an executive officer with Ichiyoshi Asset Management Co. in Tokyo. “There will be a lot of SoftBank investors that will think it’s crazy to invest this much money into one company.”

The capital infusion doesn’t give SoftBank a majority of voting rights and WeWork will be treated as an associate, not a subsidiary. That might allow SoftBank to wield influence at WeWork without having to show all of its liabilities on the balance sheet. SoftBank’s shares fell 2.5% in Tokyo on Wednesday, their biggest drop in three weeks, but off earlier lows.

As part of the deal with SoftBank, the company will offer to buy as much as $3 billion from existing shareholders, from the fourth quarter. Neumann will be allowed to sell nearly $1 billion of stock to SoftBank, a person familiar with the matter has said. The deal will enable him to retain his billionaire status, according to calculations by the Bloomberg Billionaires Index. That rich exit package has incensed a workforce facing job cuts.

The SoftBank rescue was one of two options the WeWork board was considering to keep the company afloat. The other alternative was a $5 billion debt package presented by JPMorgan Chase & Co., which people familiar with the proposal said would have been one been of the riskiest junk-debt offerings in recent years, including $2 billion of pay-in-kind bonds yielding 15%.

As recently as last month, the company appeared to be headed to the public markets. But investors balked at the company’s unusual governance structure and rapid rate of spending. According to its IPO paperwork, WeWork lost $900 million in the first half of this year alone. It’s on the hook for some $47 billion in future rent payments, thanks to its model of raising money to rent office space that it renovates and then leases to companies. That’s fueled a high cash burn rate that’s spooking investors.

The chilly public market reception prompted the company to oust Neumann as CEO last month and pull its IPO, while it tried to find a way to profitability. But making money may prove difficult. The company considers only 30% of its office space to be “mature,” which typically means generating steady revenue. It could face costs that approach $1 billion to renovate new space it has already secured. Some leases and projects, including one plan for a 36-story lease in a Seattle tower, have been scuttled as the company has floundered.

The SoftBank deal paves the way for the Japanese conglomerate to take a larger role at the troubled startup. SoftBank asked Claure, the former CEO of Sprint Corp., last month to look for ways to cut costs and raise revenue at WeWork. After Neumann’s ouster, WeWork executives Sebastian Gunningham and Artie Minson were appointed as co-CEOs, with a similar mandate to refocus on the core business.

SoftBank had already committed more than $10 billion to the startup before the rescue package. Its latest effort to shore up its troubled investment comes at a delicate time: SoftBank is currently working to raise another, larger version of its $100 billion Vision Fund, the massive tech fund that made bets in Silicon Valley so large that it changed the startup ecosystem. SoftBank was also an investor in Uber Technologies Inc., which is down by more than a quarter since its May IPO.

SoftBank’s losses from its recent investments could run into the billions of dollars. Founder Masayoshi Son is likely to address the subject when the company reports quarterly earnings on Nov. 6

“It is not unusual for the world’s leading technology disruptors to experience growth challenges as the one WeWork just faced,” Son said in the statement. “Since the vision remains unchanged, SoftBank has decided to double down on the company by providing a significant capital infusion and operational support.”