Uber, the upstart ride-sharing app, has announced a partnership with Yandex (YNDX  ), the Russian search giant that operates a similar service, Yandex.Taxi.

While the unification still requires regulatory approval, it may put an end to the war that has raged between the two companies since Uber arrived in Russia in 2013. The companies will unite to provide service in Russia and several other Eastern European countries under a new, as-yet-unannounced name. Tigran Khudaverdyan, the chief executive of Yandex.Taxi, will serve as the head of the new company. Yandex will invest $100 million and retain a 59.3% stake, while Uber will put $225 million forward and keep a 36.6% stake. Employees of the united company will hold a 4.1% stake. The new company is valued at $3.7 billion.

Uber is known for its hard-nosed tactics, staking out its own corner in the taxi industry, which is heavily regulated in many countries. Under its founder, Travis Kalanick, Uber violated TLC regulations and sparked protests amongst established cab companies and drivers in the U.S. and abroad as it sought to rapidly expand business. Kalanick recently resigned under pressure from shareholders partly due to concern about his aggressive methods of dealing with law enforcement.

The company encountered no such outcry in Russia, where before the arrival of ride-sharing apps the taxi market had traditionally been managed more informally. Private individuals would offer their personal, unmarked vehicles as taxis and haggle with passengers in cash.

Yet Uber met other challenges as it tried to stake out its territory in Russia and other countries where Yandex.Taxi operates, such as Armenia, Azerbaijan, Belarus, Georgia, and Kazakhstan. Yandex.Taxi is a massive operation nearly twice the size of Uber, and has a mapping database that gives it an advantage over routes. Yandex, the "Google of Russia," was founded in 1997, and launched its taxi service in 2011, so it was already a well-known brand in the region well before Uber arrived. Unlike Uber, Yandex has the ability to market its taxi services through its online platforms. Uber also had to compete with other rivals, such as the app Gett.

The merger, which has been in the works for months, presents advantages to both companies, as they will no longer need to spend money battling over market share. This may soothe investors who are worried about Uber's runaway spending, which remains high as they seek to expand their customer base: they lost almost $1 billion in the final quarter of 2016, and $708 million in the early months of 2017. The deal may also help shore up confidence in the company in advance of a possible future initial public offering.

Russia is not the only country where Uber has come up against fierce competition. After spending billions of dollars on rider subsidies in a bid break into the market, Uber in 2016 gave in and sold its Chinese subsidiary to Didi Chuxing, the incumbent ride-hailing app in the region, resulting in the creation of a new company in which Uber retains a share.