Uber is believed to have conceded domination of China’s ride-hailing market to rival Didi Chuxing, but it’s not walking away empty-handed. It’s now confirmed that Uber will merge its Uber China service with Didi’s in a deal that values a combined company at $35 billion. In return, Uber will receive a $1 billion investment.

The deal was reported by Bloomberg, which said that investors in Uber China will be receiving 20 percent of the new Didi Chuxing.

With this move, Uber will likely save itself quite a bit of money that it’ll be able to invest into other markets, thereby accelerating its growth. The company was said to have been losing $1 billion a year in China in its ongoing battle with Didi. In February, Uber CEO Travis Kalanick told Betakit: “We have a fierce competitor that’s unprofitable in every city they exist in, but they’re buying up market share. I wish the world wasn’t that way.”

The irony of Uber’s departure from China isn’t lost on anyone, as the company has been known to drive out competitors such as Hailo and Sidecar in the U.S. But in an added twist, Uber has made a deal with a major player, and also investor, in Lyft’s ridesharing alliance.

In a blog post that Bloomberg obtained, Kalanick explained that “Uber and Didi Chuxing are investing billions of dollars in China, and both companies have yet to turn a profit there. Getting to profitability is the only way to build a sustainable business that can best serve Chinese riders, drivers, and cities over the long term.”

Didi Chuxing was born last year in a bid to shake off any impression of it being an “illegal taxi service.” China’s government had been cracking down on ridesharing, but last week it legalized ride-hailing services.

Now that Uber is freeing up capital, how will it spend it? Expanding into new markets? Focusing more on autonomous vehicles through its Carnegie Mellon program? Or will it double-down in key existing markets to further dominate its competition?

 

Update at 10:16 p.m. Pacific on Sunday: A blog post from Kalanick announcing the deal is said to be making its way through WeChat. It says that Uber was doing more than 150 million rides a month in China, but that “being successful is about listening to your head as well as following your heart.”

Update at 10:20 a.m. Pacific on Monday: Didi Chuxing has confirmed the acquisition of Uber China. Uber will receive 5.89 percent of the combined company “with preferred equity interest which is equal to a 17.7 percent economic interest in Didi Chuxing.” Kalanick will join the board of Didi.

Uber China will retain its independent branding, but Didi will integrate the managerial and technological experience and expertise of both companies.