The biggest reason we hear so much about electric cars is because of the falling costs of batteries. Lithium-ion batteries today cost less than one-fifth as they did in 2010. Within the next five years, some experts estimate that the total cost of owning an electric car—that is, upfront cost plus lifetime fuel cost—will be lower than that of gasoline-powered cars.

In the race to make more batteries, Europe is beating the US with a little help from China.

An analysis of announced and committed investments shows that, by 2023, Europe will have more lithium-ion battery manufacturing capacity than the US. Europe is expected to increase its lithium-ion capacity from 18 GWh today—enough to make 300,000 fully electric vehicles (EVs)—to 198 GWh in the next four years. The US is only expected to grow its capacity to 130 GWh in the same period. And neither region will beat China, which is expected to reach 800 GWh by then.

In the 2000s, the US led the world in EV production and sales because of Tesla’s success and General Motor’s early bets. That means, in just a decade, the US lost the pole position to China and will soon lose second place to Europe. How did that happen?

China’s lead is easier to explain (as we did in Quartz’s field guide to electric cars). In a bid to cut deadly air pollution and lead a new industry, the Chinese government identified two crucial technologies: electric cars and lithium-ion batteries. Between 2009 and 2018, the national and local governments went on to provide as much as $60 billion in direct and indirect subsidies, creating an industry that now manufactures and sells more than 1 million EVs each year. By 2015, China’s sales of EVs surpassed that of the US—and continued to accelerate.

The European story is less straightforward. During the 2000s, European carmakers were happy to take the back seat and watch the electric-car show. The US had failed in the 1990s to build an electric-car industry, and the Europeans preferred to avoid the risk.

All that changed in 2015. In September, Volkswagen was caught using software in its diesel cars that lowered emissions readouts during laboratory driving tests. Then in December, 195 countries met in Paris to sign the first global climate agreement, which would require every sector of the economy to cut emissions. Both those events made it clear: It was time for European carmakers to embrace a cleaner future in electric cars.

And embrace they did. In the last two years, VW has committed to spend $90 billion to power its electric future. Both the Renault group and the Fiat group have committed $10 billion each towards that goal. These commitments are receiving additional support from the governments of Germany, France, the UK, Sweden, Norway, Poland, and Hungary, who are keen to cut transport emissions and ensure the European car industry survives the disruption.

The timing of Europe’s growing interest in batteries couldn’t be better. As the auto market in China slows down, its battery companies are looking to continue their explosive growth by tapping into foreign markets. That’s why the biggest commitment to build a battery factory—with a capacity of as much as 100 GWh—has come from the Chinese giant CATL, which is already the world’s largest supplier of lithium-ion batteries. Other Chinese companies like BYD, Lishen, and Farasis Energy are also going to build battery factories in Europe.

Since 2017, the US government under Donald Trump has done little to support its electric-car industry, which continues to rely heavily on the success of Tesla. Instead the administration has attempted to roll back fuel-efficiency standards, a move that’s been opposed by the auto industry itself. The continuing trade war with China has ensured that the case for Chinese battery giants to invest in the US remains shut. It’s remarkable how easily the US has thrown away its lead on a technology that the 21st century desperately needs.