Google’s parent company Alphabet doubled down on its investments in the ride-hailing space on Thursday, leading a $1 billion round in ridesharing company Lyft.

The move may seem curious to those familiar with Google’s investment history. Back in 2013, Google was a major investor in Uber, Lyft’s biggest rival. But in the past four years, alliances, rivalries, and the future of ridesharing have rapidly changed. While some of the talk from Thursday’s announcement has focused on challenging Uber’s ridesharing dominance, it’s perhaps Waymo’s race with another fast-moving rival—Chinese company Baidu—that made the investment necessary.

Google has been working on self-driving car technology since 2009, but it wasn’t until 2016 that Alphabet spun off the project as its own entity. Around the same time, a member of Google’s self-driving car team departed to form his own self-driving vehicle startup, Otto, which Uber then acquired to advance its own self-driving car efforts. Now, Uber and Waymo are embroiled in a heated intellectual property battle as Waymo alleges Otto’s co-founder, Anthony Levandowski, stole proprietary information and used it while heading up Uber’s self-driving car project. Uber fired Levandowski in May after he refused to cooperate with the lawsuit.

But bad blood with Uber wouldn’t seem to be the reason for Alphabet’s investment today. Alphabet is racing to be the first-to-market with driverless cars, and the world is full of companies trying for a piece of the self-driving car market. But Baidu, a fellow search giant turned autonomous vehicle powerhouse is on a notably aggressive timeline—and Baidu, unlike Alphabet, has a presence in both China and the United States.

Baidu chairman and CEO Robin Li said on Tuesday that the company aims to roll out driverless buses in China in 2018, produce semi-autonomous cars by 2019, and sell fully autonomous vehicles by 2021. Baidu already has more than 50 partners for its driverless car efforts, including Bosch, Continental, and Dutch mapping company TomTom.

Waymo initially had a good relationship with GM, but it will now have to compete with automakers who are working on their own self-driving vehicles. Its current fleet is composed of Chrysler Pacifica minivans. That’s part of the reason Alphabet and Lyft started working together in May, to get Waymo’s technology more places, and faster.

Lyft, which is forging partnerships with carmakers such as Ford, provides Waymo’s vehicles a chance to get out on roadways with a human available behind the wheel “just in case”—and to enable the cars to go on longer drives and navigate areas the company hadn’t yet mapped. According to a report from The Information, Waymo’s true, driverless self-driving ridesharing fleet may hit Phoenix-area roadways (where the company has been beta testing its cars in the wild) as early as this month. But rolling out a fleet nationally—or globally—will take a lot more time and manpower.

As we saw with its current pilot program, Waymo may end up partnering with Lyft in each new market it enters. Using Lyft drivers behind the wheel is a great way to ease the transition between normal automobiles and autonomous ones. Americans, according to a Pew Research Center report, are largely distrustful of driverless vehicles and want a person in the driver’s seat just in case. It makes sense then that Google would want to ensure it had a partner with enough capital to branch into new markets and afford new drivers.

Meanwhile, Baidu has made it clear that it wants to beat America in developing a self-driving car. Baidu started its driverless car project later than Google, but China’s populace may not need the Lyft-aided handholding that Americans crave. Chinese citizens were more favorable to riding in a driverless taxi than U.S. respondents were in a World Economic Forum poll. They also own fewer cars themselves. And China has a robust automotive industry, which Baidu can supply the driverless brains for.

So far, Waymo’s fleet has driven more than three million miles on city streets; Baidu is keeping its testing efforts, other than one successful trip through Beijing, under wraps. But by kickstarting its efforts with driverless buses, Baidu may be minimizing some of the challenges of individual vehicles that Waymo has to deal with. (For example, a bus would only travel on specific routes, with known speed limits and predictable dangers, and could be easily observable and serviceable in the case of a malfunction.)

At this point, though, some of Alphabet’s biggest obstacles will be the legislative and sociological hurdles it will have to overcome in offering driverless cars to the masses. And that’s why Alphabet needs Lyft—and made its support clear in today’s investment.