Less than one week after it was announced that ride-hailing services would be legalized in China, it seems Uber has given up trying to compete with local rival Didi Chuxing. Reports from Bloomberg and Recode state that Didi will swallow up Uber’s China operations in a merger deal that will create a combined business worth $35 billion.

The move looks like a good one for Uber; the company and investors in its China business will receive a 20 percent stake in the new entity, which was valued at $28 billion before the merger. Uber China had been valued at $7 billion, and the US firm was losing $1 billion a year in the country as it struggled against the local transportation giant.

Another part of the complex deal will see Didi invest $1 billion in Uber at a $68 billion valuation. The Chinese firm recently closed a $7.3 billion financing round that included a $1 billion investment from Apple, giving it plenty of cash on hand.

"As an entrepreneur, I've learned that being successful is about listening to your head as well as following your heart," wrote Uber CEO Travis Kalanick in an as yet unpublished blog post obtained by Bloomberg. "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."

As noted by TechCrunch, the move means Didi now has a stake in every large ride-sharing company on the planet, including Lyft, India’s Ola and Grab in Southeast Asia.

Didi Chuxing has a 99 percent market share of taxis in China and an 87 percent share when it comes to hailing private cars. It operates in 400 Chinese cities, whereas Uber is found in 60.