Uber (uber) put up a good fight in China, but it wasn't quite enough.
The ride-hailing company's Chinese unit is merging with local rival—and market leader—Didi Chuxing in a $35 billion deal, according to a report from Bloomberg, citing a leaked blog post draft and anonymous sources. Uber China, which is a separate business unit owned by Uber, will represent a 20% stake in the combined company, Uber co-founder and CEO Travis Kalanick said. Didi will make a $1 billion investment in Uber's main business at a $68 billion valuation.
A blog post alleged to have been penned by Kalanick announcing the merger has been circulating online and was obtained by Bloomberg. It hinted that Uber was likely planning to unveil the deal early this week.
"As an entrepreneur, I’ve learned that being successful is about listening to your head as well as following your heart," wrote Kalanick. "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."
Get Data Sheet, Fortune’s technology newsletter.
Last week, China officially legalized ride-hailing, taking both companies out of the regulatory gray zone.
Uber declined to comment on the rumors, while Didi has not returned Fortune's request for comment.
Despite Uber's incredibly aggressive approach to expanding around the world, China has been an uphill battle from the get-go. When it officially debuted its service in China in July 2014, its market was already dominated by local companies. Two of them, Didi Dache and Kuaidi Dache merged in February 2015 to form the current company known at Didi Chuxing.
Moreover, even as Uber continued to pump more and more money into its Chinese unit, its ability to eat away at Didi's market share remained small. Even after losing $1 billion a year to try to make any sort of headway in China, Uber's market share has remained minor (Uber and Didi can't seem to agree on the actual numbers).
This merger also complicates the already-messy web of investments among several ride-hailing companies. Didi is already an investor in U.S.-based Lyft (lyft), India's Ola (olacabs), and Southeast Asia's Grab (grabtaxi), with which it teamed up last fall to form a coalition for letting their respective customers use each other's services.
Didi also signed up Apple (aapl) as an investor when the companies announced in May the tech giant's $1 billion stake in the Chinese company. Meanwhile, General Motors (gm) invested $500 million in January in Lyft.
Now, with rumors that Didi plans to go public in 2017 or 2018, the merger would give Uber finally the chance to refocus on its main business, and yet benefit from the public market when the combined company does make the jump.